mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Menu: Add enabled property (#8145)
By default it's enabled, of course. This property is not only added to MenuItem, but Menu as well - since they can be nested. It's also possible to select a disabled item, but it's hard to modify that since it's logic is written in Slint. You should be prevented from activating it with a tap or key press at least. See #7791
This commit is contained in:
parent
44a1bec608
commit
d1f2fef430
8 changed files with 64 additions and 9 deletions
|
@ -85,12 +85,12 @@ export component PopupMenuImpl inherits Window {
|
|||
}
|
||||
return accept;
|
||||
} else if event.text == Key.Return {
|
||||
if current-highlight >= 0 && current-highlight < entries.length {
|
||||
if current-highlight >= 0 && current-highlight < entries.length && entries[current-highlight].enabled {
|
||||
activate(entries[current-highlight], y-pos(current-highlight), current-highlight);
|
||||
}
|
||||
return accept;
|
||||
} else if event.text == Key.RightArrow {
|
||||
if current-highlight >= 0 && current-highlight < entries.length && entries[current-highlight].has-sub-menu {
|
||||
if current-highlight >= 0 && current-highlight < entries.length && entries[current-highlight].has-sub-menu && entries[current-highlight].enabled {
|
||||
activate(entries[current-highlight], y-pos(current-highlight), current-highlight);
|
||||
}
|
||||
return accept;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue