From d9d733924c0c12fd413308707b3f6555115c4414 Mon Sep 17 00:00:00 2001 From: Jakob Petsovits Date: Sat, 6 Apr 2024 22:56:04 -0400 Subject: [PATCH] kcms/desktop: Move "Add" button and row count to header actions I swapped the order of "Add" and row count because (in LTR layouts) row captions are on the left and an "Add" button on the right sits right on top of the "Remove" buttons in the list view. --- src/kcms/desktop/ui/main.qml | 79 +++++++++++++++++------------------- 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/src/kcms/desktop/ui/main.qml b/src/kcms/desktop/ui/main.qml index ad26bfd6d6..12c27efc3e 100644 --- a/src/kcms/desktop/ui/main.qml +++ b/src/kcms/desktop/ui/main.qml @@ -14,20 +14,46 @@ import org.kde.kirigami 2.20 as Kirigami KCM.ScrollViewKCM { id: root - Connections { - target: kcm.desktopsModel - - function onReadyChanged() { - rowsSpinBox.value = kcm.desktopsModel.rows; - } - - function onRowsChanged() { - rowsSpinBox.value = kcm.desktopsModel.rows; - } - } implicitWidth: Kirigami.Units.gridUnit * 35 implicitHeight: Kirigami.Units.gridUnit * 30 + actions: [ + Kirigami.Action { + displayComponent: QQC2.SpinBox { + id: rowsSpinBox + + from: 1 + to: 20 + editable: true + value: kcm.desktopsModel.rows + + textFromValue: (value, locale) => i18np("1 Row", "%1 Rows", value) + valueFromText: (text, locale) => parseInt(text, 10) + + onValueModified: kcm.desktopsModel.rows = value + + KCM.SettingHighlighter { + highlight: kcm.desktopsModel.rows !== 2 + } + Connections { + target: kcm.desktopsModel + + function onReadyChanged() { + rowsSpinBox.value = kcm.desktopsModel.rows; + } + function onRowsChanged() { + rowsSpinBox.value = kcm.desktopsModel.rows; + } + } + } + }, + Kirigami.Action { + text: i18nc("@action:button", "Add") + icon.name: "list-add" + onTriggered: kcm.desktopsModel.createDesktop() + } + ] + Component { id: desktopsListItemComponent @@ -164,37 +190,6 @@ KCM.ScrollViewKCM { } footer: ColumnLayout { - RowLayout { - QQC2.Button { - text: i18nc("@action:button", "Add") - icon.name: "list-add" - - onClicked: kcm.desktopsModel.createDesktop() - } - - Item { // Spacer - Layout.fillWidth: true - } - - QQC2.SpinBox { - id: rowsSpinBox - - from: 1 - to: 20 - editable: true - value: kcm.desktopsModel.rows - - textFromValue: (value, locale) => i18np("1 Row", "%1 Rows", value) - valueFromText: (text, locale) => parseInt(text, 10) - - onValueModified: kcm.desktopsModel.rows = value - - KCM.SettingHighlighter { - highlight: kcm.desktopsModel.rows !== 2 - } - } - } - Kirigami.FormLayout { QQC2.CheckBox {