mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Hide action when widget is disabled
ChangeLog: TextEdit/LineEdit : disable context menu action when the widget is disabled or read-only ChangeLog: Added ContextMenuArea::enabled
This commit is contained in:
parent
bc5a468513
commit
4cd6f92013
9 changed files with 53 additions and 15 deletions
|
@ -68,10 +68,11 @@ export component LineEditBase inherits Rectangle {
|
|||
}
|
||||
|
||||
ContextMenuArea {
|
||||
enabled: root.enabled;
|
||||
Menu {
|
||||
MenuItem {
|
||||
title: @tr("Cut");
|
||||
enabled: root.enabled;
|
||||
enabled: !root.read-only && root.enabled;
|
||||
activated => {
|
||||
text-input.cut();
|
||||
}
|
||||
|
@ -79,6 +80,7 @@ export component LineEditBase inherits Rectangle {
|
|||
|
||||
MenuItem {
|
||||
title: @tr("Copy");
|
||||
enabled: !root.text.is-empty;
|
||||
activated => {
|
||||
text-input.copy();
|
||||
}
|
||||
|
@ -86,7 +88,7 @@ export component LineEditBase inherits Rectangle {
|
|||
|
||||
MenuItem {
|
||||
title: @tr("Paste");
|
||||
enabled: root.enabled;
|
||||
enabled: !root.read-only && root.enabled;
|
||||
activated => {
|
||||
text-input.paste();
|
||||
}
|
||||
|
@ -94,6 +96,7 @@ export component LineEditBase inherits Rectangle {
|
|||
|
||||
MenuItem {
|
||||
title: @tr("Select All");
|
||||
enabled: !root.text.is-empty;
|
||||
activated => {
|
||||
text-input.select-all();
|
||||
}
|
||||
|
|
|
@ -59,10 +59,11 @@ export component TextEditBase inherits Rectangle {
|
|||
forward-focus: text-input;
|
||||
|
||||
ContextMenuArea {
|
||||
enabled: root.enabled;
|
||||
Menu {
|
||||
MenuItem {
|
||||
title: @tr("Cut");
|
||||
enabled: root.enabled;
|
||||
enabled: !root.read-only && root.enabled;
|
||||
activated => {
|
||||
text-input.cut();
|
||||
}
|
||||
|
@ -70,14 +71,15 @@ export component TextEditBase inherits Rectangle {
|
|||
|
||||
MenuItem {
|
||||
title: @tr("Copy");
|
||||
enabled: !root.text.is-empty;
|
||||
activated => {
|
||||
text-input.copy();
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
enabled: !root.read-only && root.enabled;
|
||||
title: @tr("Paste");
|
||||
enabled: root.enabled;
|
||||
activated => {
|
||||
text-input.paste();
|
||||
}
|
||||
|
@ -85,6 +87,7 @@ export component TextEditBase inherits Rectangle {
|
|||
|
||||
MenuItem {
|
||||
title: @tr("Select All");
|
||||
enabled: !root.text.is-empty;
|
||||
activated => {
|
||||
text-input.select-all();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue