是否可以将属性更改扩展或动态添加到qml状态?
例如
Item {
id: myItem;
state: "opened";
states: [
State {
name: "opened";
PropertyChanges {
target: myItem;
height: 100;
}
},
State {
name: "closed";
PropertyChanges {
target: myItem;
height: 10;
}
}
]
}
但后来我希望能够向PropertyChanges添加任何其他属性,例如颜色,宽度,不透明度等。动态。 “结果”看起来像这样
State {
name: "closed";
PropertyChanges {
target: myItem;
height: 10;
color: "red";
width: 10;
opacity: 0.5;
}
}