diff options
author | Juergen Bocklage-Ryannel <juergen@ryannel.org> | 2018-12-24 15:46:42 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@googlemail.com> | 2022-01-27 13:50:04 +0100 |
commit | 031743b53259dd73b611cd9965d392558e76a79c (patch) | |
tree | 6a1664759516b3fdc02894e20f966281f1a2d45c /qface/templates/qface/qtcpp.j2 | |
parent | ca2868a450c4090d5460827a896648280bb72eb0 (diff) | |
download | qtivi-qface-031743b53259dd73b611cd9965d392558e76a79c.tar.gz |
add run option to qface script
Diffstat (limited to 'qface/templates/qface/qtcpp.j2')
-rw-r--r-- | qface/templates/qface/qtcpp.j2 | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/qface/templates/qface/qtcpp.j2 b/qface/templates/qface/qtcpp.j2 index b2e3bff..1f0fb16 100644 --- a/qface/templates/qface/qtcpp.j2 +++ b/qface/templates/qface/qtcpp.j2 @@ -17,10 +17,14 @@ Q_PROPERTY({{property|qt.returnType}} {{property}} READ {{property}} {% if not property.readonly %}WRITE push{{property|upperfirst}}{% endif %}{% if not property.const and notifiable %} NOTIFY {{property}}Changed{% endif %}) {%- endmacro %} -{% macro property_setter_decl(property, ending=";", prefix='virtual') -%} +{% macro property_pusher_decl(property, ending=";", prefix='virtual') -%} {{prefix}} void push{{property|upperfirst}}({{ property|qt.parameterType }}){{ending}} {%- endmacro %} +{% macro property_setter_decl(property, ending=";", prefix='virtual') -%} +{{prefix}} void set{{property|upperfirst}}({{ property|qt.parameterType }}){{ending}} +{%- endmacro %} + {% macro property_getter_decl(property, ending=";", prefix='virtual') -%} {{prefix}} {{property|qt.returnType}} {{property}}() const{{ending}} {%- endmacro %} @@ -33,6 +37,20 @@ void {{symbol}}{{postfix}}(); {{property|qt.returnType}} m_{{property}}; {%- endmacro %} +{% macro property_pusher_impl(class, property, notifiable=True) -%} +void {{class}}::push{{property|upperfirst}}({{ property|qt.parameterType }}) +{ +{% if notifiable %} + if (m_{{property}} != {{property}}) { + m_{{property}} = {{property}}; + Q_EMIT {{property}}Changed(); + } +{% else %} + m_{{property}} = {{property}}; +{% endif %} +} +{%- endmacro %} + {% macro property_setter_impl(class, property, notifiable=True) -%} /*! \qmlproperty {{property.type}} {{class}}::{{property}} @@ -41,7 +59,7 @@ void {{symbol}}{{postfix}}(); {{doc.description|join("\n ")}} {% endwith %} */ -void {{class}}::push{{property|upperfirst}}({{ property|qt.parameterType }}) +void {{class}}::set{{property|upperfirst}}({{ property|qt.parameterType }}) { {% if notifiable %} if (m_{{property}} != {{property}}) { |