Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
5.6.0
-
None
-
Mac, Qt 5.6
Description
The example below illustrates my problem.
I create a small `Rectangle` at the top left and clicking on it toggles the color between red and green.
Next, I create a `StackView` and I push a `Rectangle` to the `StackView` and bind the color of this second Rectangle to the color of the top-left rectangle
Expected behavior would be that, clicking on the top-left `Rectangle` would change the color of both `Rectangle` objects. Unfortunately, this is not the case.
Note that things work fine when pushing `stackRect2` to the stack (see line in comment)
Is this expected behavior or a bug?
import QtQuick 2.0 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 Window { id: mainWindow visible: true width: 1280 height: 720 Rectangle { id: rect width: 100 height: 100 focus: true color: toggle? "red":"green" property var toggle:false; MouseArea { anchors.fill: parent onClicked: rect.toggle = !rect.toggle } } StackView { id: stack width: 100 height:100 anchors.left: rect.right anchors.leftMargin: 10 Component.onCompleted: { stack.push ({item:stackRect, properties: {color:rect.color}}) //stack.push ({item:stackRect2}) } } Component { id:stackRect Rectangle {} } Component { id:stackRect2 Rectangle {color:rect.color} } }