slint
slint copied to clipboard
State inheritance / substates
As discussed in https://github.com/slint-ui/slint/issues/2047, we would need a way to have states to share common properties.
Two ways are considered:
1. inherit states
component Foo {
property <string> status;
states [
common : {
some_button.some_property: something;
/* ... more common properties */
}
open inherits common when self.status=="open":{
some_button.text: "Open";
}
close inherits common when self.status=="close":{
some_button.text: "Close";
}
// ...
]
2. sub-states
component Foo {
property <string> status;
states [
common when self.status != "" : {
some_button.some_property: something;
/* ... more common properties */
states [ // sub states
open when self.status=="open":{
some_button.text: "Open";
}
close when self.status=="close":{
some_button.text: "Close";
}
]
}
// ...
]