aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitem2/data/focusableItemReparentedToLoadedComponent.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickitem2/data/focusableItemReparentedToLoadedComponent.qml')
-rw-r--r--tests/auto/quick/qquickitem2/data/focusableItemReparentedToLoadedComponent.qml51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickitem2/data/focusableItemReparentedToLoadedComponent.qml b/tests/auto/quick/qquickitem2/data/focusableItemReparentedToLoadedComponent.qml
new file mode 100644
index 0000000000..a690c4243b
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/focusableItemReparentedToLoadedComponent.qml
@@ -0,0 +1,51 @@
+import QtQuick 2.12
+
+Item {
+ width: 240; height: 240
+ Loader {
+ id: loader
+ sourceComponent: surfaceParent
+ anchors.fill: parent
+
+ onStatusChanged: {
+ if (status === Loader.Ready) {
+ holder.create()
+ holder.item.parent = item
+ } else if (status === Loader.Null){
+ holder.item.parent = null
+ }
+ }
+ }
+
+ property var holder: QtObject {
+ property bool created: false
+ function create()
+ {
+ if (!created)
+ surfaceComponent.createObject(item)
+ created = true
+ }
+
+ property Item item: Item {
+ anchors.fill: parent
+ Component {
+ id: surfaceComponent
+ Item {
+ anchors.fill: parent
+ TextInput {
+ width: parent.width
+ font.pixelSize: 40
+ text: "focus me"
+ }
+ }
+ }
+ }
+ }
+
+ Component {
+ id: surfaceParent
+ Rectangle {
+ anchors.fill: parent
+ }
+ }
+}