emit a signal when a device name is changed so plugins can act on it

This commit is contained in:
Michael Zanetti 2018-12-01 00:26:43 +01:00
parent b911ca13a5
commit 16cdd29eb8
2 changed files with 5 additions and 1 deletions

View File

@ -96,7 +96,10 @@ QString Device::name() const
/*! Set the \a name for this Device. This is visible to the user.*/ /*! Set the \a name for this Device. This is visible to the user.*/
void Device::setName(const QString &name) void Device::setName(const QString &name)
{ {
m_name = name; if (m_name != name) {
m_name = name;
emit nameChanged();
}
} }
/*! Returns the parameter of this Device. It must match the parameter description in the associated \l{DeviceClass}. */ /*! Returns the parameter of this Device. It must match the parameter description in the associated \l{DeviceClass}. */

View File

@ -73,6 +73,7 @@ public:
signals: signals:
void stateValueChanged(const QUuid &stateTypeId, const QVariant &value); void stateValueChanged(const QUuid &stateTypeId, const QVariant &value);
void nameChanged();
private: private:
Device(const PluginId &pluginId, const DeviceId &id, const DeviceClassId &deviceClassId, QObject *parent = nullptr); Device(const PluginId &pluginId, const DeviceId &id, const DeviceClassId &deviceClassId, QObject *parent = nullptr);