diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-07-05 16:27:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-07-09 16:53:09 +0200 |
commit | 5c3326702fcb200e9af594f66696cd8c21ac7e85 (patch) | |
tree | c0d9deb7053a387243c34157af7eafdac754ae47 /tests/auto/qml/qqmllanguage | |
parent | 910f98031fdd834a22af0da21c9ff6ae145f61c5 (diff) |
Add support for type script QML signal parameter declarations
We support
signal(int param)
but we should also support
signal(param: int)
for consistency with the syntax now supported for functions.
Change-Id: Ic064bbaac45024d3663562819f3c1f3f4a918a56
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/signalParameterTypes.3.qml | 19 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 8 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/signalParameterTypes.3.qml b/tests/auto/qml/qqmllanguage/data/signalParameterTypes.3.qml new file mode 100644 index 0000000000..6dee30de95 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/signalParameterTypes.3.qml @@ -0,0 +1,19 @@ +import QtQml 2.0 + +QtObject { + id: root + + property bool success: false + + signal testSignal(param: bool) + + function handleTestSignal(param) { + success = param + } + + Component.onCompleted: { + success = false; + root.testSignal.connect(handleTestSignal) + root.testSignal(true); + } +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 11e46beb41..a54c4b35d4 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -3699,6 +3699,14 @@ void tst_qqmllanguage::signalParameterTypes() QVERIFY(obj != nullptr); QVERIFY(obj->property("success").toBool()); } + + // dynamic signal connections + { + QQmlComponent component(&engine, testFileUrl("signalParameterTypes.3.qml")); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(obj != nullptr); + QVERIFY(obj->property("success").toBool()); + } } void tst_qqmllanguage::functionParameterTypes() |