From 6b0b0a57b272057c58851048fc82ab25326c1973 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Wed, 15 Dec 2021 04:27:40 +0300 Subject: [PATCH] [applets/batterymonitor] PopupDialog: Clean up anchors-based layout Would you ever polish something before dividing it by zero? Well, at least this is somehow justifiable. Anchors were too horrible to deal with, even for a rewriting. Now they are all in one place, sorted out, and no more manual width setting. --- .../package/contents/ui/PopupDialog.qml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/applets/batterymonitor/package/contents/ui/PopupDialog.qml b/applets/batterymonitor/package/contents/ui/PopupDialog.qml index c64ad7bfe..a289c2532 100644 --- a/applets/batterymonitor/package/contents/ui/PopupDialog.qml +++ b/applets/batterymonitor/package/contents/ui/PopupDialog.qml @@ -6,6 +6,7 @@ */ import QtQuick 2.15 +import QtQuick.Layouts 1.15 import org.kde.kquickcontrolsaddons 2.1 import org.kde.plasma.components 3.0 as PlasmaComponents3 @@ -50,14 +51,18 @@ PlasmaComponents3.Page { FocusScope { anchors.fill: parent - anchors.topMargin: PlasmaCore.Units.smallSpacing * 2 focus: true Column { id: settingsColumn - anchors.horizontalCenter: parent.horizontalCenter - width: parent.width - PlasmaCore.Units.smallSpacing * 2 + anchors { + left: parent.left + right: parent.right + top: parent.top + margins: PlasmaCore.Units.smallSpacing + topMargin: PlasmaCore.Units.smallSpacing * 2 + } spacing: PlasmaCore.Units.smallSpacing * 2 BrightnessItem { @@ -123,13 +128,14 @@ PlasmaComponents3.Page { // HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890 PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff anchors { - horizontalCenter: parent.horizontalCenter top: settingsColumn.bottom + left: parent.left + right: parent.right + bottom: parent.bottom topMargin: PlasmaCore.Units.gridUnit leftMargin: PlasmaCore.Units.smallSpacing - bottom: parent.bottom + rightMargin: PlasmaCore.Units.smallSpacing } - width: parent.width - PlasmaCore.Units.smallSpacing * 2 ListView { id: batteryList