From 6bf53c8797ab585de6bf268ea415439147b1b790 Mon Sep 17 00:00:00 2001 From: Ismael Asensio Date: Fri, 28 Jan 2022 21:05:23 +0100 Subject: [PATCH] kcm/kwinrules: Keep sheet open when adding properties via button Keep properties sheet open when clicking on the button to add a new property. This allows to add several properties in a row. Clicking on the full row will keep the previous behavior for the simple case, closing the sheet so the new property can be edited right away Also make the button on each delegate always visible (not only on hover) to be more consistent with current status everywhere else. Previously the sheet would remain open only after detecting some window properties, which was a very hidden and confusing pattern. BUG: 431228 FIXED-IN: 5.26 --- .../kwinrules/package/contents/ui/RulesEditor.qml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/kcmkwin/kwinrules/package/contents/ui/RulesEditor.qml b/src/kcmkwin/kwinrules/package/contents/ui/RulesEditor.qml index 83a99b02a2..314a217b6a 100644 --- a/src/kcmkwin/kwinrules/package/contents/ui/RulesEditor.qml +++ b/src/kcmkwin/kwinrules/package/contents/ui/RulesEditor.qml @@ -218,8 +218,7 @@ ScrollViewKCM { } QQC2.ToolButton { icon.name: (model.enabled) ? "dialog-ok-apply" : "list-add" - opacity: propertyDelegate.hovered ? 1 : 0 - onClicked: propertyDelegate.clicked() + onClicked: addProperty(); Layout.preferredWidth: implicitWidth Layout.leftMargin: -Kirigami.Units.smallSpacing Layout.rightMargin: -Kirigami.Units.smallSpacing @@ -228,14 +227,16 @@ ScrollViewKCM { } onClicked: { + addProperty(); + propertySheet.close(); + } + + function addProperty() { model.enabled = true; if (model.suggested != null) { model.value = model.suggested; model.suggested = null; } - if (!overlayModel.onlySuggestions) { - propertySheet.close(); - } } } }