From 3a0a744051d73c18a2960645c58528a0cfbce1a2 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Mon, 27 Jun 2022 23:47:51 -0400 Subject: [PATCH] quicksettings: Fix brightness slider alignment, and forced row count --- .../qml/actiondrawer/quicksettings/QuickSettings.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettings.qml b/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettings.qml index d5eafaf3..bb2edee7 100644 --- a/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettings.qml +++ b/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettings.qml @@ -43,8 +43,14 @@ Item { readonly property MobileShell.QuickSettingsModel quickSettingsModel: MobileShell.QuickSettingsModel {} - readonly property int rowCount: Math.floor(Window.height * 65/100 / rowHeight) readonly property int columnCount: Math.floor(width/columnWidth) + readonly property int rowCount: { + let totalRows = quickSettingsCount / columnCount; + let isPortrait = MobileShell.Shell.orientation === MobileShell.Shell.Portrait; + let targetRows = Math.floor(Window.height * (isPortrait ? 0.65 : 0.8) / rowHeight); + return Math.min(totalRows, targetRows); + } + readonly property int pageSize: rowCount * columnCount readonly property int quickSettingsCount: quickSettingsModel.count