diff options
-rw-r--r-- | src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl | 8 | ||||
-rw-r--r-- | src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl b/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl index 45ac204..afca8dc 100644 --- a/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl +++ b/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl @@ -124,7 +124,7 @@ void {{zone_class}}::emitCurrentState() {{class}}::{{class}}(QObject *parent) : {{class}}Interface(parent) - , m_node(new QRemoteObjectNode) + , m_node(nullptr) , m_helper(new QIviRemoteObjectReplicaHelper(qLcRO{{interface}}(), this)) {% for property in interface.properties %} {% if property.type.is_model %} @@ -283,6 +283,9 @@ bool {{class}}::connectToNode() QUrl registryUrl = QUrl(settings.value(QStringLiteral("Registry"), QStringLiteral("local:{{module.module_name|lower}}")).toString()); if (m_url != registryUrl) { m_url = registryUrl; + // QtRO doesn't allow to change the URL without destroying the Node + delete m_node; + m_node = new QRemoteObjectNode(); if (!m_node->connectToNode(m_url)) { qCCritical(qLcRO{{interface}}) << "Connection to" << m_url << "failed!"; m_replica.reset(); @@ -313,7 +316,8 @@ void {{class}}::setupConnections() m_synced = false; }); {% else %} - connect(m_replica.data(), &QRemoteObjectReplica::initialized, this, &QIviFeatureInterface::initializationDone); + //As the Replica is now initialized, this will trigger an update of all properties (not just the changed ones) + connect(m_replica.data(), &QRemoteObjectReplica::initialized, this, &{{class}}::initialize); {% endif %} {% for property in interface.properties if not property.type.is_model %} {% if interface_zoned %} diff --git a/src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl b/src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl index d95a447..2816d38 100644 --- a/src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl +++ b/src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl @@ -42,7 +42,7 @@ Q_LOGGING_CATEGORY(qLcRO{{interface}}{{property|upper_first}}, "{{module|qml_typ {{class}}::{{class}}(QObject* parent) : QIviPagingModelInterface(parent) - , m_node(new QRemoteObjectNode) + , m_node(nullptr) , m_helper(new QIviRemoteObjectReplicaHelper(qLcRO{{interface}}{{property|upper_first}}(), this)) { qRegisterMetaType<QIviPagingModelInterface*>(); @@ -101,6 +101,9 @@ bool {{class}}::connectToNode() QUrl registryUrl = QUrl(settings.value(QStringLiteral("Registry"), QStringLiteral("local:{{module.module_name|lower}}")).toString()); if (m_url != registryUrl) { m_url = registryUrl; + // QtRO doesn't allow to change the URL without destroying the Node + delete m_node; + m_node = new QRemoteObjectNode(); if (!m_node->connectToNode(m_url)) { qCCritical(qLcRO{{interface}}{{property|upper_first}}) << "Connection to" << m_url << "failed!"; m_replica.reset(); |