Details
-
Bug
-
Resolution: Invalid
-
P3: Somewhat important
-
4.7.0
-
Mac OS 10.6.4
Qt Creator 2.0.93 (beta-2)
Description
Hi,
please consider the following to files:
TestComponent.qml
import Qt 4.7 Rectangle { anchors.fill: parent width: 200 height: 200 color: "#f88" Component.onCompleted: { console.log("TestComponent.onCompleted()"); console.log(" width:", width); } focus: true onWidthChanged: { console.log("width changed to:", width); } Keys.onPressed: { console.log("on Key pressed", event.key); } }
and...
BugKeyboard.qml :
import Qt 4.7
Rectangle {
width: 200
height: 200
Component {
id: testComponent
TestComponent {}
}
Loader {
id: mainLoader
anchors.fill: parent
sourceComponent: testComponent
}
}
Viewing BugLoader will print out the following console output:
TestComponent.onCompleted() width: 200 width changed to: 0 width changed to: 0 width changed to: 200 width changed to: 640 width changed to: 200
I have two problems here:
1. I can never trigger the Keys.onPressed hander of TestComponent when loaded as a Component.
However it works just fine, when embedded like this:
import Qt 4.7
Rectangle {
width: 200
height: 200
TestComponent {}
}
2. I'm stunned by the weird triggering of onWidthChanged(). Where does the 640 come from? Why setting this property so often. And most important: Why isn't the width set inCompleted if not set explicitly?