I have a MyInnerRectangle
component inside a MyRectangle
.
I want to be able to set MyInnerRectangle.enabled
to true
even if MyRectangle.enabled
is set to false
.
Is that possible ? If yes how ?
I may have misunderstood how enabled
property works.
I tried this :
Disclaimer, these files may not work properly and I work with Qt 5.3.2 (an old version).
// MyInnerRectangle.qml
import QtQuick 2.3
import UI_Components 1.0
Rectangle {
color: "red"
Component.onCompleted: {
console.log("InnerRectangle : enabled: " + enabled + ", visible: " + visible)
}
}
// MyRectangle.qml
import QtQuick 2.3
import UI_Components 1.0
Rectangle {
property alias innerEnabled: innerRectangle.enabled
color: "green"
anchors.fill: parent
MyInnerRectangle {
id: innerRectangle
visible: enabled
width: parent.height/2
height: parent.height/2
anchors.centerIn: parent
}
}
In the main.qml (this file may not be complete, as it is a part of my app)
// in main.qml
MyRectangle {
enabled : false
innerEnabled: true
anchors.fill: parent
}
But this will display :
qml: InnerRectangle : enabled: false, visible: false
When I expect true