diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2018-05-16 10:31:40 +0200 |
---|---|---|
committer | Antti Hölttä <ahoelttae@luxoft.com> | 2018-05-16 14:50:19 +0000 |
commit | 61bc5e6c8c02fdd5878692cf963d505eb19e5536 (patch) | |
tree | a530a06c9f90ed0036196c85cb60b6ec80e5fd39 | |
parent | 0a8b98085f3e4ff59da0616a6b9b4140cea8e99e (diff) |
ivigenerator: Fix the compilation errors introducec by the last commit
The control_panel template cannot use the 'operation' macro yet, as it
cannot provide any return value at the moment. This commit will revert
this part to the original version.
In structs the Q_PROPERTY macro cannot have a change signal, because of
that a new notify parameter is added to the 'property' macro and the
is set to false when used inside the struct.*.tpl
Change-Id: Ic4c74d92c5e8e978e993ad937d86267118110883
Reviewed-by: Antti Hölttä <ahoelttae@luxoft.com>
5 files changed, 12 insertions, 6 deletions
diff --git a/src/tools/ivigenerator/common/qtivi_macros.j2 b/src/tools/ivigenerator/common/qtivi_macros.j2 index 1fb754f..2d07d76 100644 --- a/src/tools/ivigenerator/common/qtivi_macros.j2 +++ b/src/tools/ivigenerator/common/qtivi_macros.j2 @@ -79,13 +79,18 @@ QIviPendingReply<{{operation|return_type}}> {{scope}}{{operation}}({{join_params {# property declaration, Q_PROPERTY(...) #} -{% macro property(property) %} +{% macro property(property, notify = true) %} {% if property.readonly or property.const %} {% set write = '' %} {% else %} {% set write = ' WRITE ' + property|setter_name %} {% endif %} -Q_PROPERTY({{property|return_type}} {{property}} READ {{property|getter_name}}{{write}} NOTIFY {{property}}Changed) +{% if notify %} +{% set _notify = ' NOTIFY ' + property|lowerfirst + 'Changed' %} +{% else %} +{% set _notify = ''%} +{% endif %} +Q_PROPERTY({{property|return_type}} {{property}} READ {{property|getter_name}}{{write}}{{_notify}}) {% endmacro %} diff --git a/src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl b/src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl index af5b6a0..db89c84 100644 --- a/src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl +++ b/src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl @@ -224,7 +224,7 @@ QVariantMap {{class}}::zoneAt() const {% if interface_zoned %} {% for operation in interface.operations %} -{{ivi.operation(operation, class, true)}} +void {{class}}::{{operation}}({{ivi.join_params(operation, zoned=true)}}) { QString z = zone; if (z.isEmpty()) diff --git a/src/tools/ivigenerator/templates_control_panel/interface.h.tpl b/src/tools/ivigenerator/templates_control_panel/interface.h.tpl index 2e39194..b273d1e 100644 --- a/src/tools/ivigenerator/templates_control_panel/interface.h.tpl +++ b/src/tools/ivigenerator/templates_control_panel/interface.h.tpl @@ -102,7 +102,7 @@ public Q_SLOTS: Q_SIGNALS: {% for operation in interface.operations %} - {{ivi.operation(operation)}}; + void {{operation}}({{ivi.join_params(operation)}}); {% endfor %} {% if interface_zoned %} void currentZoneChanged(); @@ -115,7 +115,7 @@ Q_SIGNALS: private Q_SLOTS: {% if interface_zoned %} {% for operation in interface.operations %} - {{ivi.operation(operation, zoned = true)}}; + void {{operation}}({{ivi.join_params(operation, zoned=true)}}); {% endfor %} {% endif %} private: diff --git a/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl b/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl index 3e5e229..deec4b3 100644 --- a/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl +++ b/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl @@ -36,6 +36,7 @@ # # SPDX-License-Identifier: LGPL-3.0 #} +{% import 'qtivi_macros.j2' as ivi %} {% set class = '{0}Module'.format(module.module_name) %} {% include 'generated_comment.cpp.tpl' %} diff --git a/src/tools/ivigenerator/templates_frontend/struct.h.tpl b/src/tools/ivigenerator/templates_frontend/struct.h.tpl index 0f4a26f..5eda736 100644 --- a/src/tools/ivigenerator/templates_frontend/struct.h.tpl +++ b/src/tools/ivigenerator/templates_frontend/struct.h.tpl @@ -64,7 +64,7 @@ class {{exportsymbol}} {{class}} { Q_GADGET {% for field in struct.fields %} - {{ivi.property(field)}} + {{ivi.property(field, notify=false)}} {% endfor %} Q_CLASSINFO("IviPropertyDomains", "{{ struct.fields|json_domain|replace("\"", "\\\"") }}") public: |