aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/data
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2022-09-14 11:23:10 +0200
committerSami Shalayel <sami.shalayel@qt.io>2022-09-19 17:15:12 +0200
commit57808284db19eb588bcb1dbc4dd611541f745efe (patch)
tree1fc3570812a280b3f2643f7dd7dc56ab109b7250 /tests/auto/qml/qqmllanguage/data
parentc506b7182fe0aa94cb70c4efb7f3230cbd12845e (diff)
qml: allow inline component types as signal argument
The resolution of inline components through QQmlType was failing and therefore inline components were not allowed as signal parameters. Apply the same fix as 2a37ff2f49140272d0122ccc097cc14c2fa4133e to signal parameter-type resolution. Test if signals with inline-component-typed parameters works, even if the inline component is defined in another qml file. SignalInlineComponentArg.qml is capitalized as it is used in signalInlineComponentArg1.qml. Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-106611 Change-Id: I2bbcee56025e6a319a3fea9b7aedf703afabe6b3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/data')
-rw-r--r--tests/auto/qml/qqmllanguage/data/SignalInlineComponentArg.qml21
-rw-r--r--tests/auto/qml/qqmllanguage/data/signalInlineComponentArg1.qml30
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/SignalInlineComponentArg.qml b/tests/auto/qml/qqmllanguage/data/SignalInlineComponentArg.qml
new file mode 100644
index 0000000000..0424ac1534
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/SignalInlineComponentArg.qml
@@ -0,0 +1,21 @@
+import QtQuick
+
+Item {
+ component Abc: Item {
+ property string success
+ }
+
+ signal canYouFeelIt(arg1: Abc)
+ property Abc someAbc: Abc {
+ success: "Signal was called"
+ }
+ property string success: "Signal not called yet"
+
+ Component.onCompleted: {
+ canYouFeelIt(someAbc);
+ }
+
+ onCanYouFeelIt: (arg) => {
+ success = arg.success
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/signalInlineComponentArg1.qml b/tests/auto/qml/qqmllanguage/data/signalInlineComponentArg1.qml
new file mode 100644
index 0000000000..e20710edd9
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signalInlineComponentArg1.qml
@@ -0,0 +1,30 @@
+import QtQuick
+
+// this file performs two tests: first, using a signal with a inline component from another file
+// and second, calling the signal from another file using an inline component from another file
+
+Item {
+ signal canYouFeelIt(arg1:SignalInlineComponentArg.Abc)
+
+ property SignalInlineComponentArg.Abc someAbc: SignalInlineComponentArg.Abc {
+ success: "Own signal was called with component from another file"
+ }
+
+ property SignalInlineComponentArg fromAnotherFile: SignalInlineComponentArg {}
+
+ // success of own signal call with parameter from another file
+ property string successFromOwnSignal: "Signal not called yet"
+ // makes it easier to test
+ property string successFromSignalFromFile: fromAnotherFile.success
+
+ Component.onCompleted: {
+ canYouFeelIt(someAbc);
+ fromAnotherFile.someAbc.success = "Signal was called from another file"
+ fromAnotherFile.canYouFeelIt(fromAnotherFile.someAbc)
+ }
+
+ onCanYouFeelIt: (arg) => {
+ successFromOwnSignal = arg.success
+ }
+}
+