From aaa060d6c1ff6ed3734e0a8a9b47e289fb78f9bf Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Fri, 15 Oct 2021 05:24:39 +0300 Subject: [PATCH] KCM: Implement better layout Text labels without extra margins on the left looked mis-positioned. --- .../package/contents/ui/main.qml | 144 ++++++++++-------- 1 file changed, 79 insertions(+), 65 deletions(-) diff --git a/src/kcmkwin/kwindecoration/package/contents/ui/main.qml b/src/kcmkwin/kwindecoration/package/contents/ui/main.qml index 2f9dd9e832..a1b20c6a91 100644 --- a/src/kcmkwin/kwindecoration/package/contents/ui/main.qml +++ b/src/kcmkwin/kwindecoration/package/contents/ui/main.qml @@ -61,55 +61,63 @@ Kirigami.Page { Layout.fillWidth: true Layout.fillHeight: true + // Note: StackLayout does not support neither anchor.margins, not Layout.margins properties. StackLayout { anchors.fill: parent currentIndex: tabBar.currentIndex - Item { - KCM.SettingStateBinding { - target: themes - configObject: kcm.settings - settingName: "pluginName" + ColumnLayout { + spacing: 0 + + Themes { + id: themes + + Layout.fillWidth: true + Layout.fillHeight: true + + KCM.SettingStateBinding { + target: themes + configObject: kcm.settings + settingName: "pluginName" + } } - ColumnLayout { - anchors.fill: parent + RowLayout { + // default bottom padding of a Frame is fine. + Layout.topMargin: Kirigami.Units.smallSpacing + // no right margin is OK for button, but bad for text label on the left. + Layout.leftMargin: Kirigami.Units.smallSpacing - Themes { - id: themes - Layout.fillWidth: true - Layout.fillHeight: true + QQC2.Label { + text: i18nc("Selector label", "Window border size:") } - RowLayout { - QQC2.Label { - text: i18nc("Selector label", "Window border size:") + QQC2.ComboBox { + id: borderSizeComboBox + model: kcm.borderSizesModel + currentIndex: kcm.borderIndex + onActivated: { + kcm.borderIndex = currentIndex } - QQC2.ComboBox { - id: borderSizeComboBox - model: kcm.borderSizesModel - currentIndex: kcm.borderIndex - onActivated: { - kcm.borderIndex = currentIndex - } - KCM.SettingHighlighter { - highlight: kcm.borderIndex != 0 - } + KCM.SettingHighlighter { + highlight: kcm.borderIndex != 0 } - Item { - Layout.fillWidth: true - } - NewStuff.Button { - id: newstuffButton - text: i18nc("button text", "Get New Window Decorations...") - icon.name: "get-hot-new-stuff" - visible: KAuthorized.authorize("ghns") - configFile: "window-decorations.knsrc" - onEntryEvent: function (entry, event) { - if (event == 1) { // StatusChangedEvent - kcm.reloadKWinSettings() - } + } + + Item { + Layout.fillWidth: true + } + + NewStuff.Button { + id: newstuffButton + text: i18nc("button text", "Get New Window Decorations...") + icon.name: "get-hot-new-stuff" + visible: KAuthorized.authorize("ghns") + configFile: "window-decorations.knsrc" + onEntryEvent: function (entry, event) { + if (event == 1) { // StatusChangedEvent + kcm.reloadKWinSettings() } } } @@ -117,45 +125,51 @@ Kirigami.Page { } ColumnLayout { + spacing: 0 + Buttons { Layout.fillWidth: true Layout.fillHeight: true Layout.margins: Kirigami.Units.smallSpacing } - QQC2.CheckBox { - id: closeOnDoubleClickOnMenuCheckBox - text: i18nc("checkbox label", "Close windows by double clicking the menu button") - checked: kcm.settings.closeOnDoubleClickOnMenu - onToggled: { - kcm.settings.closeOnDoubleClickOnMenu = checked - infoLabel.visible = checked + ColumnLayout { + Layout.margins: Kirigami.Units.smallSpacing + + QQC2.CheckBox { + id: closeOnDoubleClickOnMenuCheckBox + text: i18nc("checkbox label", "Close windows by double clicking the menu button") + checked: kcm.settings.closeOnDoubleClickOnMenu + onToggled: { + kcm.settings.closeOnDoubleClickOnMenu = checked + infoLabel.visible = checked + } + + KCM.SettingStateBinding { + configObject: kcm.settings + settingName: "closeOnDoubleClickOnMenu" + } } - KCM.SettingStateBinding { - configObject: kcm.settings - settingName: "closeOnDoubleClickOnMenu" + Kirigami.InlineMessage { + Layout.fillWidth: true + id: infoLabel + type: Kirigami.MessageType.Information + text: i18nc("popup tip", "Click and hold on the menu button to show the menu.") + showCloseButton: true + visible: false } - } - Kirigami.InlineMessage { - Layout.fillWidth: true - id: infoLabel - type: Kirigami.MessageType.Information - text: i18nc("popup tip", "Click and hold on the menu button to show the menu.") - showCloseButton: true - visible: false - } + QQC2.CheckBox { + id: showToolTipsCheckBox + text: i18nc("checkbox label", "Show titlebar button tooltips") + checked: kcm.settings.showToolTips + onToggled: kcm.settings.showToolTips = checked - QQC2.CheckBox { - id: showToolTipsCheckBox - text: i18nc("checkbox label", "Show titlebar button tooltips") - checked: kcm.settings.showToolTips - onToggled: kcm.settings.showToolTips = checked - - KCM.SettingStateBinding { - configObject: kcm.settings - settingName: "showToolTips" + KCM.SettingStateBinding { + configObject: kcm.settings + settingName: "showToolTips" + } } } }