From a3723c7e7b699db77e23db2917b3d4cefbdd57e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Tue, 19 Aug 2025 17:54:55 +0200 Subject: [PATCH] implement configurable column number in quicksettings panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This changeset makes the shell respect the quickSettingsColumns mobile shell setting. It renders the number of columns correctly and makes the drawer wider, as needed. As a side-effect, the width is now more dpi-independant since it switches from raw pixel values to gridUnit. Another side effect is that we make the individual quicksettings buttons ever so slightly wider (5.333 gridUnits before, gridUnits now). Signed-off-by: Sebastian Kügler --- .../qml/actiondrawer/private/LandscapeContentContainer.qml | 4 +++- .../mobileshell/qml/actiondrawer/private/QuickSettings.qml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/mobileshell/qml/actiondrawer/private/LandscapeContentContainer.qml b/components/mobileshell/qml/actiondrawer/private/LandscapeContentContainer.qml index cb22d589..e2106837 100644 --- a/components/mobileshell/qml/actiondrawer/private/LandscapeContentContainer.qml +++ b/components/mobileshell/qml/actiondrawer/private/LandscapeContentContainer.qml @@ -12,6 +12,7 @@ import org.kde.plasma.core as PlasmaCore import org.kde.plasma.plasma5support 2.0 as P5Support import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.private.mobileshell as MobileShell +import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS /** @@ -54,7 +55,8 @@ Item { height: quickSettingsPanel.contentImplicitHeight + quickSettingsPanel.topPadding + quickSettingsPanel.bottomPadding width: intendedWidth - readonly property real intendedWidth: 360 + readonly property real columnWidth: 6 * Kirigami.Units.gridUnit + readonly property real intendedWidth: (columnWidth * ShellSettings.Settings.quickSettingsColumns) + Kirigami.Units.gridUnit property real offsetRatio: quickSettingsPanel.height / root.height anchors.topMargin: Math.min(root.actionDrawer.offsetResistance * offsetRatio - quickSettingsPanel.height, 0) diff --git a/components/mobileshell/qml/actiondrawer/private/QuickSettings.qml b/components/mobileshell/qml/actiondrawer/private/QuickSettings.qml index 4069eec9..2206cafa 100644 --- a/components/mobileshell/qml/actiondrawer/private/QuickSettings.qml +++ b/components/mobileshell/qml/actiondrawer/private/QuickSettings.qml @@ -11,6 +11,7 @@ import QtQuick.Layouts 1.1 import QtQuick.Window 2.2 import org.kde.plasma.private.mobileshell as MobileShell +import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS import org.kde.kirigami 2.20 as Kirigami @@ -28,7 +29,7 @@ Item { required property QS.QuickSettingsModel quickSettingsModel - readonly property real columns: Math.round(Math.min(6, Math.max(3, width / intendedColumnWidth))) + readonly property real columns: Math.round(Math.min(6, Math.max(ShellSettings.Settings.quickSettingsColumns, width / intendedColumnWidth))) readonly property real columnWidth: Math.floor(width / columns) readonly property int minimizedColumns: Math.round(Math.min(8, Math.max(5, width / intendedMinimizedColumnWidth))) readonly property real minimizedColumnWidth: Math.floor(width / minimizedColumns)