我有CoolButton
一个pressed
状态:
// CoolButton.qml:
BorderImage {
...
states: State {
name: "pressed"
when: mouseArea.pressed == true
PropertyChanges { target: shade; opacity: 0.5 }
}
}
和MenuButton
延伸CoolButton
:
// MenuButton.qml:
CoolButton {
...
states: State {
name: "pressed"
PropertyChanges { ... }
}
}
但是,中pressed
定义的状态MenuButton
似乎根本不起作用。pressed
它是否被 中定义的状态隐藏CoolButton
?我怎样才能覆盖它?
应该是这样的吗?
// MenuButton.qml:
CoolButton {
...
states: State {
name: "pressed"
extend: "CoolButton.pressed"
PropertyChanges { ... }
}
}