From 8a6e5ebaad8e2cd2ce4b258c4f1ed05f3a44a558 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Wed, 15 Dec 2021 04:55:24 +0300 Subject: [PATCH] [applets/batterymonitor] PopupDialog: Move battery list inside ColumnLayout No visually observable changes, again. But it replaces most of the anchors tweaking with a simple QtQuick.Layout interface. You might've noticed how topMargin: PlasmaCore.Units.gridUnit got replaced with a different-looking Layout.topMargin: PlasmaCore.Units.smallSpacing * 2 but that's all according to the plan, since this ScrollView is now inside a ColumnLayout which has its own spacing that adds up. Also, settingsColumn id is removed because it became unused. --- .../package/contents/ui/PopupDialog.qml | 51 +++++++++---------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/applets/batterymonitor/package/contents/ui/PopupDialog.qml b/applets/batterymonitor/package/contents/ui/PopupDialog.qml index 4957f4908..9d37db223 100644 --- a/applets/batterymonitor/package/contents/ui/PopupDialog.qml +++ b/applets/batterymonitor/package/contents/ui/PopupDialog.qml @@ -55,13 +55,11 @@ PlasmaComponents3.Page { focus: true ColumnLayout { - id: settingsColumn anchors { - left: parent.left - right: parent.right - top: parent.top - margins: PlasmaCore.Units.smallSpacing + fill: parent topMargin: PlasmaCore.Units.smallSpacing * 2 + leftMargin: PlasmaCore.Units.smallSpacing + rightMargin: PlasmaCore.Units.smallSpacing } spacing: PlasmaCore.Units.smallSpacing * 2 @@ -125,34 +123,31 @@ PlasmaComponents3.Page { profileHolds: dialog.profileHolds onActivateProfileRequested: dialog.activateProfileRequested(profile) } - } - PlasmaComponents3.ScrollView { - // HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890 - PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff - anchors { - top: settingsColumn.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - topMargin: PlasmaCore.Units.gridUnit - leftMargin: PlasmaCore.Units.smallSpacing - rightMargin: PlasmaCore.Units.smallSpacing - } + PlasmaComponents3.ScrollView { + // HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890 + PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff - ListView { - id: batteryList + // additional margin, because the bottom of PowerProfileItem + // and the top of BatteryItem are more dense. + Layout.topMargin: PlasmaCore.Units.smallSpacing * 2 + Layout.fillWidth: true + Layout.fillHeight: true + + ListView { + id: batteryList - boundsBehavior: Flickable.StopAtBounds - spacing: PlasmaCore.Units.smallSpacing * 2 + boundsBehavior: Flickable.StopAtBounds + spacing: PlasmaCore.Units.smallSpacing * 2 - KeyNavigation.tab: brightnessSlider - KeyNavigation.backtab: pmSwitch + KeyNavigation.tab: brightnessSlider + KeyNavigation.backtab: pmSwitch - delegate: BatteryItem { - width: ListView.view.width - battery: model - matchHeightOfSlider: brightnessSlider.slider + delegate: BatteryItem { + width: ListView.view.width + battery: model + matchHeightOfSlider: brightnessSlider.slider + } } } }