Ref T166, identifier can be set

(in case an identifier from a higher level should be set)
This commit is contained in:
Klaus Basan
2017-09-28 04:27:24 +02:00
parent a196015b73
commit 3ca352a2a1
2 changed files with 5 additions and 3 deletions

View File

@@ -21,9 +21,9 @@ namespace BlackMisc
CIdentifiable::CIdentifiable(QObject *object) : m_identifier(object->objectName()) CIdentifiable::CIdentifiable(QObject *object) : m_identifier(object->objectName())
{ {
// if the object name changes we update our originator // if the object name changes we update our originator
this->m_connection = QObject::connect(object, &QObject::objectNameChanged, [this, object]() m_connection = QObject::connect(object, &QObject::objectNameChanged, [this, object]()
{ {
this->m_identifier = CIdentifier(object->objectName()); m_identifier = CIdentifier(object->objectName());
}); });
} }
@@ -31,5 +31,4 @@ namespace BlackMisc
{ {
QObject::disconnect(m_connection); QObject::disconnect(m_connection);
} }
} // ns } // ns

View File

@@ -32,6 +32,9 @@ namespace BlackMisc
//! Get identifier //! Get identifier
const CIdentifier &identifier() const { return m_identifier; } const CIdentifier &identifier() const { return m_identifier; }
//! Set identifier, allows to set an external identifier
void setIdentifier(const CIdentifier &identifier) { m_identifier = identifier; }
//! Identifier with current timestamp //! Identifier with current timestamp
CIdentifier getCurrentTimestampIdentifier() const; CIdentifier getCurrentTimestampIdentifier() const;