diff options
-rw-r--r-- | src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl | 2 | ||||
-rw-r--r-- | src/tools/ivigenerator/templates/common/backend_simulation.cpp.tpl | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl b/src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl index 5a46282..cf9aebc 100644 --- a/src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl +++ b/src/tools/ivigenerator/templates/backend_qtro/backend.cpp.tpl @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE {% if property.type.is_model %} , m_{{property}}(new Zoned{{property|upperfirst}}ModelBackend(QStringLiteral("{{interface.qualified_name}}.{{property}}.") + m_zone, this)) {% else %} - , m_{{ property }}({{property|default_value}}) + , m_{{ property }}({{property|default_type_value}}) {% endif %} {% endfor %} { diff --git a/src/tools/ivigenerator/templates/common/backend_simulation.cpp.tpl b/src/tools/ivigenerator/templates/common/backend_simulation.cpp.tpl index 4c146e1..f8f2cd7 100644 --- a/src/tools/ivigenerator/templates/common/backend_simulation.cpp.tpl +++ b/src/tools/ivigenerator/templates/common/backend_simulation.cpp.tpl @@ -149,6 +149,12 @@ QStringList {{class}}::availableZones() const void {{class}}::initialize() { +{% if interface.tags.config.zoned %} + // To initialize the default values all zone objects need to be created. For zoned backends + // the availableZones() method is responsible for that, just make sure this is called before + // initialize to have them created before. + availableZones(); +{% endif %} QIVI_SIMULATION_TRY_CALL({{class}}, "initialize", void); {% for property in interface.properties %} {% if not interface_zoned %} @@ -173,7 +179,8 @@ void {{class}}::initialize() {% if interface_zoned %} void {{class}}::addZone(const QString &zone) { - m_zones->insert(zone, QVariant::fromValue(new {{zone_class}}(zone, this))); + if (!m_zones->contains(zone)) + m_zones->insert(zone, QVariant::fromValue(new {{zone_class}}(zone, this))); } {{zone_class}}* {{class}}::zoneAt(const QString &zone) |