Commit 2a4dd9fb authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Allow setting SensorObject's name after construction

It's just a user visible string so there seems no harm in this. It is
not yet properly signalled to the client that it changed however.
parent 06caa120
......@@ -61,6 +61,16 @@ QString SensorObject::path() const
return m_parent->id() % QLatin1Char('/') % m_id;
}
void SensorObject::setName(const QString& newName)
{
if (newName == m_name) {
return;
}
m_name = newName;
Q_EMIT nameChanged();
}
void SensorObject::setParentContainer(SensorContainer* parent)
{
m_parent = parent;
......
......@@ -40,8 +40,10 @@ public:
~SensorObject();
QString id() const;
QString name() const;
QString path() const;
QString name() const;
void setName(const QString &newName);
void setParentContainer(SensorContainer *parent);
QList<SensorProperty *> sensors() const;
......@@ -50,6 +52,7 @@ public:
void addProperty(SensorProperty *property);
bool isSubscribed() const;
Q_SIGNALS:
/**
* Emitted when a client subscribes to one or more of the underlying properties of this object
......@@ -62,6 +65,11 @@ Q_SIGNALS:
*/
void aboutToBeRemoved();
/**
* Emitted whenever the object's name changes.
*/
void nameChanged();
private:
SensorContainer *m_parent = nullptr;
QString m_id;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment