aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2019-09-04 13:08:28 +0200
committerAndy Shaw <andy.shaw@qt.io>2019-09-06 14:40:33 +0200
commita3564a54881c7d49ef0f688e2215f03e81da3d79 (patch)
tree8bad6a0fa8afd970a92de7245005c2261bfac737
parent652b913691985979a3c4f90483bab880603f8303 (diff)
Protect against unused variable warnings when no properties are added
Change-Id: Ie41f7d15bdcc3c2bdcf7de299063d016186bd3a1 Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r--src/tools/ivigenerator/templates_frontend/interface.cpp.tpl8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
index c6a5a63..545566e 100644
--- a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
+++ b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
@@ -235,13 +235,15 @@ void {{class}}Private::on{{signal|upperfirst}}({{ivi.join_params(signal)}})
{% if not module.tags.config.disablePrivateIVI %}
bool {{class}}Private::notify(const QByteArray &propertyName, const QVariant &value)
{
+{% if interface.properties %}
auto q = getParent();
-{% for property in interface.properties %}
+{% for property in interface.properties %}
if (propertyName == QByteArray("{{property}}")) {
emit q->{{property}}Changed(value.value<{{property|return_type}}>());
return true;
}
-{% endfor %}
+{% endfor %}
+{% endif %}
{% if interface.tags.config.zoned %}
return QIviAbstractZonedFeaturePrivate::notify(propertyName, value);
{% else %}
@@ -419,7 +421,9 @@ QIviAbstractZonedFeature *{{class}}::createZoneFeature(const QString &zone)
/*! \internal */
void {{class}}::connectToServiceObject(QIviServiceObject *serviceObject)
{
+{% if interface.properties or interface.signals %}
auto d = {{class}}Private::get(this);
+{% endif %}
auto *backend = {{interface|lower}}Backend();
if (!backend)