Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.0
-
Microsoft Visual C++ Compiler 16.7.30413.136
-
-
2425cd478138c52694aaa20b7f7eb4a91d97b51c (qt/qtdeclarative/dev) 5652923d99166e942385eb35b778d26b55ab4b0a (qt/qtdeclarative/5.15) cdfb593985496f70b33e295f35b84c8dcf494cc2 (qt/qtdeclarative/5.15.2)
Description
When properties of inline components are changed using states, the property does not appear to change.
In the following example there are two rectangles. One of them is an inline component, the other is not. The rectangle instantiated by the loader gets the correct color (green), but the rectangle of the inline component does not.
import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 ApplicationWindow { id: root visible: true width: 800 height: 600 ColumnLayout { component RectComponent: Rectangle { id: myRect2 implicitWidth: 10 implicitHeight: 10 color: "red" states: [ State { name: "myState" PropertyChanges { target: myRect2 color: "green" } } ] Component.onCompleted: state = "myState" } Component { id: rectComponent Rectangle { id: myRect1 implicitWidth: 10 implicitHeight: 10 color: "red" states: [ State { name: "myState" PropertyChanges { target: myRect1 color: "green" } } ] Component.onCompleted: state = "myState" } } Loader { sourceComponent: rectComponent } RectComponent {} } }