aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Hölttä <AHoelttae@luxoft.com>2018-04-26 13:02:59 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2018-05-03 13:08:02 +0000
commit753c35e2003b96175ccb40b9dfb709d20b620c72 (patch)
treed81830611ee1087854ab0395b2f7bea982da92a1
parent6e95e95bce698ad1844099c5bc4b5822e56ecb06 (diff)
Change the example walkthroughs to include code from files
Use qdoc \snippet instead of hard coded snippets in the QtIvi core example walkthroughs Task-number: AUTOSUITE-278 Change-Id: Icd966aeb53805d7b0009db490d5c462c22d75bf8 Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r--examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro18
-rw-r--r--examples/ivicore/qface-ivi-climate/demo/main.qml3
-rw-r--r--examples/ivicore/qface-ivi-climate/frontend/frontend.pro10
-rw-r--r--examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro18
-rw-r--r--examples/ivicore/qface-ivi-remote/demo/main.qml7
-rw-r--r--examples/ivicore/qface-ivi-remote/example-ivi-remote.qface5
-rw-r--r--examples/ivicore/qface-ivi-remote/frontend/frontend.pro10
-rw-r--r--examples/ivicore/qface-ivi-remote/server_qtro/main.cpp3
-rw-r--r--examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp3
-rw-r--r--examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h4
-rw-r--r--examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro7
-rw-r--r--src/ivicore/doc/src/examples-qface-ivi-climate.qdoc43
-rw-r--r--src/ivicore/doc/src/examples-qface-ivi-remote.qdoc123
13 files changed, 78 insertions, 176 deletions
diff --git a/examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro b/examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro
index 4f13532..53dd135 100644
--- a/examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro
+++ b/examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro
@@ -1,25 +1,27 @@
TEMPLATE=lib
TARGET = $$qtLibraryTarget(example_ivi_climate)
-CONFIG += ivigenerator plugin
macos: CONFIG += debug_and_release build_all
QT_FOR_CONFIG += ivicore
!qtConfig(ivigenerator): error("No ivigenerator available")
LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviClimateExample)
+#! [0]
DESTDIR = ../qtivi
-
+#! [0]
CONFIG += warn_off
+#! [1]
INCLUDEPATH += $$OUT_PWD/../frontend
-PLUGIN_TYPE = qtivi
-PLUGIN_EXTENDS = qtivi
-PLUGIN_CLASS_NAME = ClimatePlugin
-
+#! [1]
QT += core ivicore
-
+#! [2]
+CONFIG += ivigenerator plugin
QFACE_FORMAT = backend_simulator
QFACE_SOURCES = ../example-ivi-climate.qface
-
+PLUGIN_TYPE = qtivi
+PLUGIN_EXTENDS = qtivi
+PLUGIN_CLASS_NAME = ClimatePlugin
+#! [2]
CONFIG += install_ok # Do not cargo-cult this!
target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-ivi-climate/qtivi/
INSTALLS += target
diff --git a/examples/ivicore/qface-ivi-climate/demo/main.qml b/examples/ivicore/qface-ivi-climate/demo/main.qml
index 6d6b543..6dab041 100644
--- a/examples/ivicore/qface-ivi-climate/demo/main.qml
+++ b/examples/ivicore/qface-ivi-climate/demo/main.qml
@@ -52,9 +52,11 @@
import QtQuick 2.7
import QtQuick.Window 2.2
+//! [0]
import IviClimate 1.0
Window {
+
visible: true
width: 640
height: 480
@@ -71,6 +73,7 @@ Window {
Text {
text: "Air Conditioning: " + climateCtrl.airConditioning
}
+//! [0]
Text {
text: "Heater: " + climateCtrl.heater
}
diff --git a/examples/ivicore/qface-ivi-climate/frontend/frontend.pro b/examples/ivicore/qface-ivi-climate/frontend/frontend.pro
index 7ebda2f..fb07a8a 100644
--- a/examples/ivicore/qface-ivi-climate/frontend/frontend.pro
+++ b/examples/ivicore/qface-ivi-climate/frontend/frontend.pro
@@ -1,18 +1,18 @@
TARGET = $$qtLibraryTarget(QtIviClimateExample)
TEMPLATE = lib
-CONFIG += ivigenerator
DESTDIR = ..
macos: CONFIG += debug_and_release build_all
-
+#! [0]
QT_FOR_CONFIG += ivicore
!qtConfig(ivigenerator): error("No ivigenerator available")
-
+#! [0]
QT += ivicore ivicore-private qml quick
DEFINES += QT_BUILD_CLIMATE_LIB
-
+#! [1]
+CONFIG += ivigenerator
QFACE_SOURCES = ../example-ivi-climate.qface
-
+#! [1]
CONFIG += install_ok # Do not cargo-cult this!
target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-ivi-climate
INSTALLS += target
diff --git a/examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro b/examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro
index 6b7f191..5d790d6 100644
--- a/examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro
+++ b/examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro
@@ -1,25 +1,27 @@
TEMPLATE=lib
TARGET = $$qtLibraryTarget(example_ivi_remote)
-CONFIG += ivigenerator plugin
macos: CONFIG += debug_and_release build_all
QT_FOR_CONFIG += ivicore
!qtConfig(ivigenerator): error("No ivigenerator available")
LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviRemoteExample)
+#! [0]
DESTDIR = ../qtivi
-
+#! [0]
CONFIG += warn_off
+#! [1]
INCLUDEPATH += $$OUT_PWD/../frontend
-PLUGIN_TYPE = qtivi
-PLUGIN_EXTENDS = qtivi
-PLUGIN_CLASS_NAME = RemoteClientPlugin
-
+#! [1]
QT += core ivicore
-
+#! [2]
+CONFIG += ivigenerator plugin
QFACE_FORMAT = backend_qtro
QFACE_SOURCES = ../example-ivi-remote.qface
-
+PLUGIN_TYPE = qtivi
+PLUGIN_EXTENDS = qtivi
+PLUGIN_CLASS_NAME = RemoteClientPlugin
+#! [2]
CONFIG += install_ok # Do not cargo-cult this!
target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-ivi-remote/qtivi/
INSTALLS += target
diff --git a/examples/ivicore/qface-ivi-remote/demo/main.qml b/examples/ivicore/qface-ivi-remote/demo/main.qml
index a5c6c80..e19f26f 100644
--- a/examples/ivicore/qface-ivi-remote/demo/main.qml
+++ b/examples/ivicore/qface-ivi-remote/demo/main.qml
@@ -53,6 +53,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.3
import QtQuick.Window 2.2
+//! [0]
import IviRemote 1.0
Window {
@@ -64,12 +65,14 @@ Window {
UiProcessingService {
id: processingService
}
+//! [0]
Column {
anchors.fill: parent
anchors.margins: 10
Row {
+ //! [1]
Button {
text: "Process"
@@ -81,6 +84,7 @@ Window {
resultLabel.text = "failed"
} )
}
+ //! [1]
TextField {
placeholderText: "text to process"
id: inputField
@@ -91,7 +95,7 @@ Window {
Text { text: "Processing result: " }
Text { id: resultLabel }
}
-
+ //! [2]
Row {
Text { text: "Last message: " }
Text {
@@ -99,5 +103,6 @@ Window {
text: processingService.lastMessage
}
}
+ //! [2]
}
}
diff --git a/examples/ivicore/qface-ivi-remote/example-ivi-remote.qface b/examples/ivicore/qface-ivi-remote/example-ivi-remote.qface
index 444163e..af45423 100644
--- a/examples/ivicore/qface-ivi-remote/example-ivi-remote.qface
+++ b/examples/ivicore/qface-ivi-remote/example-ivi-remote.qface
@@ -1,12 +1,14 @@
/**
* Test module
*/
+//! [0]
module Example.IVI.Remote 1.0;
-
+//! [0]
/**
* The ProcessingService provides a QML interface to a service doing
* all sorts of heavy processing
*/
+//! [1]
@config: { id: "example.qtivi.ProcessingService/1.0", qml_type: "UiProcessingService" }
interface ProcessingService {
@@ -14,3 +16,4 @@ interface ProcessingService {
int process(string data);
}
+//! [1]
diff --git a/examples/ivicore/qface-ivi-remote/frontend/frontend.pro b/examples/ivicore/qface-ivi-remote/frontend/frontend.pro
index 9259b86..20e5207 100644
--- a/examples/ivicore/qface-ivi-remote/frontend/frontend.pro
+++ b/examples/ivicore/qface-ivi-remote/frontend/frontend.pro
@@ -1,18 +1,18 @@
TARGET = $$qtLibraryTarget(QtIviRemoteExample)
TEMPLATE = lib
-CONFIG += ivigenerator
DESTDIR = ..
macos: CONFIG += debug_and_release build_all
-
+#! [0]
QT_FOR_CONFIG += ivicore
!qtConfig(ivigenerator): error("No ivigenerator available")
-
+#! [0]
QT += ivicore ivicore-private qml quick
DEFINES += QT_BUILD_REMOTE_LIB
-
+#! [1]
+CONFIG += ivigenerator
QFACE_SOURCES = ../example-ivi-remote.qface
-
+#! [1]
CONFIG += install_ok # Do not cargo-cult this!
target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-ivi-remote
INSTALLS += target
diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/main.cpp b/examples/ivicore/qface-ivi-remote/server_qtro/main.cpp
index 9eb73d4..2c917ab 100644
--- a/examples/ivicore/qface-ivi-remote/server_qtro/main.cpp
+++ b/examples/ivicore/qface-ivi-remote/server_qtro/main.cpp
@@ -49,7 +49,7 @@
** SPDX-License-Identifier: BSD-3-Clause
**
****************************************************************************/
-
+//! [0]
#include <QCoreApplication>
#include "processingservice.h"
@@ -64,3 +64,4 @@ int main(int argc, char *argv[])
return app.exec();
}
+//! [0]
diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp
index a3f154c..e554ef8 100644
--- a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp
+++ b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp
@@ -51,7 +51,7 @@
****************************************************************************/
#include "processingservice.h"
-
+//! [0]
ProcessingService::ProcessingService()
{
setLastMessage("Service online.");
@@ -62,3 +62,4 @@ int ProcessingService::process(const QString & data)
setLastMessage(QStringLiteral("Processed data \'%1\'").arg(data));
return data.length();
}
+//! [0]
diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h
index c7ef6b8..8c7f6b2 100644
--- a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h
+++ b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h
@@ -52,7 +52,7 @@
#ifndef PROCESSINGSERVICE_H
#define PROCESSINGSERVICE_H
-
+//! [0]
#include "rep_processingservice_source.h"
class ProcessingService : public ProcessingServiceSimpleSource
@@ -62,5 +62,5 @@ public:
int process(const QString & data) override;
};
-
+//! [0]
#endif // PROCESSINGSERVICE_H
diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro b/examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro
index 145872e..69b7e62 100644
--- a/examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro
+++ b/examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro
@@ -1,8 +1,9 @@
TARGET = qface-ivi-remote-server
+#! [0]
TEMPLATE = app
-
QT -= gui
CONFIG += c++11 ivigenerator
+#! [0]
CONFIG -= app_bundle
DESTDIR = ../
@@ -13,10 +14,10 @@ SOURCES += main.cpp \
processingservice.cpp
QMAKE_RPATHDIR += $ORIGIN
-
+#! [1]
QFACE_FORMAT = server_qtro
QFACE_SOURCES = ../example-ivi-remote.qface
-
+#! [1]
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
diff --git a/src/ivicore/doc/src/examples-qface-ivi-climate.qdoc b/src/ivicore/doc/src/examples-qface-ivi-climate.qdoc
index c66bc0a..3305951 100644
--- a/src/ivicore/doc/src/examples-qface-ivi-climate.qdoc
+++ b/src/ivicore/doc/src/examples-qface-ivi-climate.qdoc
@@ -200,10 +200,7 @@ behavior implementations. More on that in the \l {Backend Simulator Plugin} sect
In order to call the autogenerator for our shared library, the qmake project file needs to use the
\e ivigenerator qmake feature. The following snippet shows how it can be added:
-\code
-CONFIG += ivigenerator
-QFACE_SOURCES = ../example-ivi-climate.qface
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-climate/frontend/frontend.pro 1
By adding \e ivigenerator to the \e CONFIG variable, the \e ivigenerator feature file will be
loaded and interpret the \e QFACE_SOURCES variable similar to \e SOURCES variable of normal qmake
@@ -212,10 +209,7 @@ Activating the qmake feature using the \e CONFIG variable has the disadvantage t
report any errors if the feature is not available. Because of this, it is encouraged to use the
following additional code to report errors:
-\code
-QT_FOR_CONFIG += ivicore
-!qtConfig(ivigenerator): error("No ivigenerator available")
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-climate/frontend/frontend.pro 0
The other part of the project file is a normal library setup which is supposed to work on
Linux, macOS and Windows.
@@ -229,11 +223,7 @@ backend_simulator template from the same IDL file as the \e frontend library. Th
works in the same way, but it is using the \e QFACE_FORMAT variable to tell the ivigenerator to use
a different generation template.
-\code
-CONFIG += ivigenerator plugin
-QFACE_FORMAT = backend_simulator
-QFACE_SOURCES = ../example-ivi-climate.qface
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro 2
As we want to generate a plugin instead of a plain library, we need to instrument qmake to do so by
adding \e plugin to the \e CONFIG variable. For the plugin to compile correctly it needs to get the
@@ -241,9 +231,7 @@ backend interface header from the previously created library. As this header is
is not part of our source tree, but part of the build tree. We do this by adding it to the include
path using the following construct:
-\code
-INCLUDEPATH += $$OUT_PWD/../frontend
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro 1
The \e backend_simulator template will make use of the \b @config_simulator annotations explained
above. This means the generated backend will provide the default values defined in the annotations
@@ -267,22 +255,8 @@ In our QML application, we still need to import the module using the name we pro
{ClimateModule::registerQmlTypes}. Afterwards the interface can be instantiated like any other
QML item.
-\badcode
-import IviClimate 1.0
-
-Item {
-
-...
-
- UiClimateControl {
- id: climateCtrl
- }
-
- Text {
- text: "Air Conditioning: " + climateCtrl.airConditioning
- }
-}
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-climate/demo/main.qml 0
+\dots 0
As our application doesn't know about the existence of our backend plugin, we need to put this
plugin in a folder where our application searches for plugins. By default Qt either search in the
@@ -290,7 +264,6 @@ plugin in a folder where our application searches for plugins. By default Qt eit
application. For QtIvi plugins to be found, they need to be provided within a \b qtivi sub-folder.
This is achieved automatically by adding the following line to our backend project file:
-\code
-DESTDIR = ../qtivi
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro 0
+
*/
diff --git a/src/ivicore/doc/src/examples-qface-ivi-remote.qdoc b/src/ivicore/doc/src/examples-qface-ivi-remote.qdoc
index a652c36..651c7c7 100644
--- a/src/ivicore/doc/src/examples-qface-ivi-remote.qdoc
+++ b/src/ivicore/doc/src/examples-qface-ivi-remote.qdoc
@@ -57,22 +57,11 @@ contains a single interface with a single property and a single method.
First we need to define which \e module we want to describe. The \e module acts as a namespace,
because the IDL file can contain multiple interfaces.
-\code
-module Example.IVI.Remote 1.0;
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/example-ivi-remote.qface 0
The most important part is the definition of the \e interface.
-\code
-
-interface ProcessingService {
-
- string lastMessage;
-
- int process(string data);
-}
-
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/example-ivi-remote.qface 1
In this case, we define an \e interface named \b ProcessingService consisting of a single property
and a single method. Every property and method definition needs to contain at least a type and a
@@ -90,10 +79,7 @@ change the behavior implementations.
In order to call the autogenerator for our shared library, the qmake project file needs to use the
\e ivigenerator qmake feature. The following snippet shows how it can be added:
-\code
-CONFIG += ivigenerator
-QFACE_SOURCES = ../example-ivi-climate.qface
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/frontend/frontend.pro 1
By adding \e ivigenerator to the \e CONFIG variable, the \e ivigenerator feature file will be
loaded and interpret the \e QFACE_SOURCES variable similar to \e SOURCES variable of normal qmake
@@ -102,10 +88,7 @@ Activating the qmake feature using the \e CONFIG variable has the disadvantage t
report any errors if the feature is not available. Because of this, it is encouraged to use the
following additional code to report errors:
-\code
-QT_FOR_CONFIG += ivicore
-!qtConfig(ivigenerator): error("No ivigenerator available")
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/frontend/frontend.pro 0
The other part of the project file is a normal library setup which is supposed to work on
Linux, macOS and Windows.
@@ -119,11 +102,7 @@ plugin here will work as a client that connects to the server using the Qt Remot
integration works in the same way, but it is using the \e QFACE_FORMAT variable to tell the
ivigenerator to use a different generation template, \e backend_qtro:
-\code
-CONFIG += ivigenerator plugin
-QFACE_FORMAT = backend_qtro
-QFACE_SOURCES = ../example-ivi-climate.qface
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro 2
The generated backend plugin code is usable as is, and doesn't require further changes by the
developer. As we want to generate a plugin instead of a plain library, we need to instrument qmake
@@ -132,9 +111,7 @@ to get the backend interface header from the previously created library. As this
generated, it is not part of our source tree, but part of the build tree. We do this by adding it to
the include path using the following construct:
-\code
-INCLUDEPATH += $$OUT_PWD/../frontend
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro 1
Most of the code in the backend plugin is generated by the IVI Generator, but some of it is
generated by the Qt's remote object compiler (repc). This is achieved by IVI Generator producing an
@@ -149,9 +126,7 @@ plugin in a folder where our application searches for plugins. By default Qt eit
application. For QtIvi plugins to be found, they need to be provided within a \b qtivi sub-folder.
This is achieved automatically by adding the following line to our backend project file:
-\code
-DESTDIR = ../qtivi
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro 0
\section1 RemoteObjects Server
@@ -161,14 +136,9 @@ backend and hence needs to have most of its implementation written by the develo
the generator produces some code to simplify the development. We can generate server side code by
using the IVI Generator with \e server_qtro template:
-\code
-TEMPLATE = app
-QT -= gui
-CONFIG += c++11 ivigenerator
-...
-QFACE_FORMAT = server_qtro
-QFACE_SOURCES = ../example-ivi-remote.qface
-\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro 0
+\dots 0
+\snippet ../../../../examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro 1
To use the generated remote source, we need to inherit from one of the classes defined in the
generated rep_processingservice_source.h file. In this example we implement our servers logic in the
@@ -176,16 +146,8 @@ ProcessingService class and use the ProcessingServiceSimpleSource as the base cl
\code
// server_qtro/processingservice.h
-#include "rep_processingservice_source.h"
-
-class ProcessingService : public ProcessingServiceSimpleSource
-{
-public:
- ProcessingService();
-
- int process(const QString & data) override;
-};
\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h 0
Please notice, that the base class contains already the definitions for property accessors, but any
custom method or slot needs to be overridden and defined by the developer. Our implementation of the
@@ -194,17 +156,8 @@ property:
\code
// server_qtro/processingservice.cpp
-ProcessingService::ProcessingService()
-{
- setLastMessage("Service online.");
-}
-
-int ProcessingService::process(const QString & data)
-{
- setLastMessage("Processed data \'" +data+"\'");
- return data.length();
-}
\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp 0
In order to make the class \b ProcessingService accessible remotely, we need to share it. This is
done with the QRemoteObjectNode::enableRemoting() function. The generated Core class provides a
@@ -215,21 +168,8 @@ the start of the main event loop:
\code
// server_qtro/main.cpp
-#include <QCoreApplication>
-
-#include "processingservice.h"
-#include "core.h"
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
-
- ProcessingService service;
- Core::instance()->host()->enableRemoting(&service,"Example.IVI.Remote.ProcessingService");
-
- return app.exec();
-}
\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/server_qtro/main.cpp 0
Implementing a service that is accessible remotely is as simple as that; use the properties as usual
and provide the method implementations. The QtRemoteObjects library takes care of the communication.
@@ -251,20 +191,9 @@ QML item.
\code
// demo/main.qml
-import IviRemote 1.0
-
-Window {
-
-...
-
- UiProcessingService {
- id: processingService
- }
-
-...
-
-}
\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/demo/main.qml 0
+\dots 0
Every method call that is made through a generated API, is asynchronous. This means,
that instead of directly returning a return value, a \c {QIviPendingReply} object is returned.
@@ -273,33 +202,15 @@ that are called when the method call has been successfully finished or if it has
\code
// demo/main.qml
-Button {
- text: "Process"
-
- onClicked: processingService.process(inputField.text).then(
- function(result) { //success callback
- resultLabel.text = result
- },
- function() { //failure callback
- resultLabel.text = "failed"
- }
- )
-}
\endcode
+\snippet ../../../../examples/ivicore/qface-ivi-remote/demo/main.qml 1
In case of properties, we just use bindings as usual:
\code
// demo/main.qml
-Row {
- Text { text: "Last message: " }
- Text {
- id: serverMessage
- text: processingService.lastMessage
- }
-}
\endcode
-
+\snippet ../../../../examples/ivicore/qface-ivi-remote/demo/main.qml 2
\section1 Running the Example