diff options
author | Mike Krus <mike.krus@kdab.com> | 2017-08-21 13:40:44 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2017-08-21 13:18:35 +0000 |
commit | 264e918238b2ff62daf72ff42022a7156167146c (patch) | |
tree | d6d1e9acc61761e81672c130159c5ad68180514e | |
parent | 6145285f9f9c15928100590b15c45430241fb640 (diff) |
Fix overriding properties
When setting overridden values, there was no way to know if the values
needed to be pushed to the backend. Setter now returns true if the
values are overridden.
Change-Id: I53444099520f75cb48f334591104aca9eb18d41e
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r-- | src/ivicore/qiviabstractfeature_p.h | 2 | ||||
-rw-r--r-- | src/tools/ivigenerator/templates_frontend/interface.cpp.tpl | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/ivicore/qiviabstractfeature_p.h b/src/ivicore/qiviabstractfeature_p.h index 865e641..2d25183 100644 --- a/src/ivicore/qiviabstractfeature_p.h +++ b/src/ivicore/qiviabstractfeature_p.h @@ -66,7 +66,7 @@ public: virtual ~QIviPropertyOverrider() { } virtual QVariant property(int propertyIndex) const = 0; - virtual void setProperty(int propertyIndex, const QVariant &value) = 0; + virtual bool setProperty(int propertyIndex, const QVariant &value) = 0; private: Q_DISABLE_COPY(QIviPropertyOverrider) }; diff --git a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl index 244b611..bbb8c9a 100644 --- a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl +++ b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl @@ -255,10 +255,12 @@ void {{class}}::{{property|setter_name}}({{ property|parameter_type }}) if (d->m_{{property}} == {{property}}) return; {% if not module.tags.config.disablePrivateIVI %} + bool sendToBackend = true; if (Q_UNLIKELY(d->m_propertyOverride)) { QVariant v = qVariantFromValue<{{property|return_type}}>({{property}}); - d->m_propertyOverride->setProperty(metaObject()->indexOfProperty("{{property}}"), v); - } else { + sendToBackend = !d->m_propertyOverride->setProperty(metaObject()->indexOfProperty("{{property}}"), v); + } + if (sendToBackend) { {% else %} { {% endif %} |