quicksettings: Limit to 5 rows maximum on one page

Any more than that, and it gets disorienting for long phones.
This commit is contained in:
Devin Lin 2022-11-11 21:29:05 -05:00
parent cf756bba6d
commit f85df674f1

View file

@ -47,8 +47,9 @@ Item {
readonly property int rowCount: { readonly property int rowCount: {
let totalRows = Math.ceil(quickSettingsCount / columnCount); let totalRows = Math.ceil(quickSettingsCount / columnCount);
let isPortrait = MobileShell.Shell.orientation === MobileShell.Shell.Portrait; let isPortrait = MobileShell.Shell.orientation === MobileShell.Shell.Portrait;
let maxRows = 5; // more than 5 is just disorienting
let targetRows = Math.floor(Window.height * (isPortrait ? 0.65 : 0.8) / rowHeight); let targetRows = Math.floor(Window.height * (isPortrait ? 0.65 : 0.8) / rowHeight);
return Math.min(totalRows, targetRows); return Math.min(maxRows, Math.min(totalRows, targetRows));
} }
readonly property int pageSize: rowCount * columnCount readonly property int pageSize: rowCount * columnCount