aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2019-07-09 09:12:01 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2019-07-10 09:24:27 +0000
commitc27554068efe63d2093d6a28cc83cb95190003a2 (patch)
tree0dbe40277a7c5d3c988630d15ef40c5d2dd96da2 /src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp
parent1c84e6debfc05e60f1f331ba5f1f265ec6590a8b (diff)
Fix docs to explain the new type syntax for QML methods
[ChangeLog][QtQml] It is now possible to specify types for method parameters and their return value in QML (basic and object types), using TypeScript-like syntax with a colon separator. The syntax for QML declared signals supports the same style. This change also adapts the remaining snippets and docs to the "fresher" qml signal parameter syntax. Change-Id: I601781f01f696276951b04785584adab39fedfd9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp')
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp b/src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp
index c82f71f749..a562eae2b4 100644
--- a/src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp
+++ b/src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp
@@ -60,13 +60,13 @@ QQmlEngine engine;
QQmlComponent component(&engine, "MyItem.qml");
QObject *object = component.create();
-QVariant returnedValue;
-QVariant msg = "Hello from C++";
+QString returnedValue;
+QString msg = "Hello from C++";
QMetaObject::invokeMethod(object, "myQmlFunction",
- Q_RETURN_ARG(QVariant, returnedValue),
- Q_ARG(QVariant, msg));
+ Q_RETURN_ARG(QString, returnedValue),
+ Q_ARG(QString, msg));
-qDebug() << "QML function returned:" << returnedValue.toString();
+qDebug() << "QML function returned:" << returnedValue;
delete object;
//![0]
}