diff options
author | Antti Hölttä <AHoelttae@luxoft.com> | 2018-03-14 10:55:55 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2018-03-15 10:52:54 +0000 |
commit | 7c70805cfde54d840b39bdfeb1d02e95a3c84d5b (patch) | |
tree | 4f60c037fa5cff5687ff0f81f200e548d082d5b4 /src/tools/ivigenerator/templates_backend_qtro | |
parent | 45b8001bc1e656bf2e6248d7706670de5f565ac9 (diff) | |
download | qtivi-7c70805cfde54d840b39bdfeb1d02e95a3c84d5b.tar.gz |
Fix the custom signals and slots in qtro templates
Fix the custom slot implememtation in qtro templates. Calling a slot
on a remote object replica causes an asynchronous call and returns a
pending result object. The current backend slot implementation merely
waits for the call to finish before returning to the code that uses it.
This behavior will change when all method calls are made asynchronous.
Also add tests for passing a remote objects initial values to newly
connected clients.
Change-Id: I278bfc583a657e8a30265af8ec6c02e178f0f245
Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Diffstat (limited to 'src/tools/ivigenerator/templates_backend_qtro')
-rw-r--r-- | src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl b/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl index 12d6e94..a30437b 100644 --- a/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl +++ b/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl @@ -103,9 +103,18 @@ void {{class}}::set{{property|upperfirst}}({{ property|parameter_type }}) {% set operation_parameters = operation.parameters|map('parameter_type')|join(', ') %} {{operation|return_type}} {{class}}::{{operation}}({{operation_parameters}}){%if operation.const %} const{% endif %} { - m_replica->{{operation}}({{operation.parameters|join(', ')}}); +{% if not operation.type.is_void %} + QRemoteObjectPendingReply<{{operation|return_type}}> reply; + reply = m_replica->{{operation}}({{operation.parameters|join(', ')}}); + if (reply.waitForFinished()) + return reply.returnValue(); + qDebug() << "{{class}}, remote call of method {{operation}} failed"; return {{operation|default_value}}; +{% else %} + m_replica->{{operation}}({{operation.parameters|join(', ')}}); +{% endif %} } + {% endfor %} void {{class}}::setupConnections() |