-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 2a37ff2 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>
- Loading branch information
1 parent
c506b71
commit 5780828
Showing
4 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/auto/qml/qqmllanguage/data/SignalInlineComponentArg.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
tests/auto/qml/qqmllanguage/data/signalInlineComponentArg1.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters