Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.3.0
-
None
Description
import QtQuick 2.2 import QtQuick.Controls 1.1 ApplicationWindow { visible: true width: 640 height: 480 Item { id: style property color mySpecialColor: "#0000ff" } Text{ Component.onCompleted: print("just the Text: " + style.mySpecialColor) } Item { Component.onCompleted: print("inside Item: " + style.mySpecialColor) Text{ Component.onCompleted: print("inside Item/Text: " + style.mySpecialColor) } } Component { id: myDelegate Item { Component.onCompleted: print("inside Component: " + style.mySpecialColor) Text{ Component.onCompleted: print("inside Component/Text: " + style.mySpecialColor) } } } Loader{ sourceComponent: myDelegate anchors.centerIn: parent } }
- Output is:
qml: inside Component: #0000ff qml: inside Component/Text: undefined qml: inside Item: #0000ff qml: inside Item/Text: #0000ff qml: just the Text: #0000ff
You see the "undefined" output? This comes because Text has a property style. One strange thing is that this behaves different if that is in a component or not.
The other strange thing is that the QML parser does not give me a warning about ambiguous values. Is that possible?