-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
Qt for MCUs 1.5
-
None
-
-
8
-
QUL Sprint 1.6/2022
If a custom widget changes its properties based on a state change, the original property value gets overwritten with default property value and not with the instantiated value
root example qml:
Rectangle {
id: test
width: 1280
height: 720
color: "black"
Timer{
interval: 1500
running: true
repeat: true
onTriggered: rect.state = (rect.state === "Test1"? "Test2" : "Test1")
}
Rect {
id: rect
x: 200
y: 100
}
}
custom item QML:
Rectangle{
id: rect
width: 100
height: 100
color: "red"
states: [
State {
name: "Test1"
},
State {
name: "Test2"
PropertyChanges{
target: rect
x: (500 - width) / 2
y: (500 - height) / 2
}
}
]
}
It looks like this is valid for all properties, I tested it for x, y, width, height, color.
Looking into the sourc code this is obvious, as the retun value for all states is hardcoded the default value and not the actual value from intantiation.