Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.0
-
None
-
0b175f5f224e33f4e51873607fe78a4c203ab896
Description
Running the code below should result in a 100x100 pixels blue rectangle
in the center of a white window. Instead the entire window is blue.
Also, the "parent" property of the blue rectangle is not set by the time its
Component.onCompleted is called.
import Qt 4.7 Rectangle { width: 800 height: 460 Loader { objectName: "the loader" anchors.fill: parent sourceComponent: blueRect } Component { id: blueRect Rectangle { objectName: "blue rectangle" width: 100; height: 100 // Bug: Rect fills the loader anchors.centerIn: parent color: "blue" Component.onCompleted: print("Parent: " + parent.objectName) // Bug: "parent" is null Timer { running: true interval: 1000 // onTriggered: { print(parent); } // Bug: Results in "null" printed // onTriggered: { print("Parent: " + parent); } // Works fine onTriggered: { print("Parent of blue rect: " + parent.parent.objectName); } // Now blue rect has a parent } } } }