From 8d3ec2f89810b55839824cc4d047391a5381cc8e Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 11 Jan 2022 22:08:18 +0000 Subject: [PATCH] [applets]: Fix scrolling in ScrollViews CCBUG: 448243 --- .../package/contents/ui/PopupDialog.qml | 12 +----------- .../package/contents/ui/FullRepresentation.qml | 7 +++---- .../package/contents/ui/FullRepresentation.qml | 9 ++++----- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/applets/batterymonitor/package/contents/ui/PopupDialog.qml b/applets/batterymonitor/package/contents/ui/PopupDialog.qml index aa55b2354..b91eb5f69 100644 --- a/applets/batterymonitor/package/contents/ui/PopupDialog.qml +++ b/applets/batterymonitor/package/contents/ui/PopupDialog.qml @@ -161,17 +161,7 @@ PlasmaComponents3.Page { KeyNavigation.backtab: pmSwitch delegate: BatteryItem { - // Add a padding between an item and the scroll bar. - // Anchors are well-behaved in RTL environments too. - anchors { - left: parent ? parent.left : undefined - right: parent ? parent.right : undefined - rightMargin: { - const scrollBar = batteryScrollView.PlasmaComponents3.ScrollBar.vertical; - const hasScrollBar = scrollBar !== null && scrollBar.visible; - return hasScrollBar ? (PlasmaCore.Units.smallSpacing * 2) : 0; - } - } + width: ListView.view.width battery: model remainingTime: dialog.remainingTime matchHeightOfSlider: brightnessSlider.slider diff --git a/applets/devicenotifier/package/contents/ui/FullRepresentation.qml b/applets/devicenotifier/package/contents/ui/FullRepresentation.qml index 9f91eb700..03c0c9236 100644 --- a/applets/devicenotifier/package/contents/ui/FullRepresentation.qml +++ b/applets/devicenotifier/package/contents/ui/FullRepresentation.qml @@ -120,9 +120,6 @@ PlasmaExtras.Representation { PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff anchors.fill: parent - leftPadding: PlasmaCore.Units.smallSpacing * 2 - rightPadding: PlasmaCore.Units.smallSpacing * 2 - contentItem: ListView { id: notifierDialog @@ -131,7 +128,7 @@ PlasmaExtras.Representation { model: filterModel delegate: DeviceItem { - width: notifierDialog.width - (scrollView.PlasmaComponents3.ScrollBar.vertical.visible ? PlasmaCore.Units.smallSpacing * 4 : 0) + width: ListView.view.width - PlasmaCore.Units.smallSpacing * 4 udi: DataEngineSource } highlight: PlasmaComponents.Highlight { } @@ -140,6 +137,8 @@ PlasmaExtras.Representation { topMargin: PlasmaCore.Units.smallSpacing * 2 bottomMargin: PlasmaCore.Units.smallSpacing * 2 + leftMargin: PlasmaCore.Units.smallSpacing * 2 + rightMargin: PlasmaCore.Units.smallSpacing * 2 spacing: PlasmaCore.Units.smallSpacing currentIndex: devicenotifier.currentIndex diff --git a/applets/notifications/package/contents/ui/FullRepresentation.qml b/applets/notifications/package/contents/ui/FullRepresentation.qml index 22867985a..90048f609 100644 --- a/applets/notifications/package/contents/ui/FullRepresentation.qml +++ b/applets/notifications/package/contents/ui/FullRepresentation.qml @@ -228,10 +228,6 @@ PlasmaExtras.Representation { id: scrollView anchors.fill: parent background: null - leftPadding: PlasmaCore.Units.smallSpacing * 2 - rightPadding: PlasmaCore.Units.smallSpacing * 2 - - // HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890 PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff @@ -239,8 +235,11 @@ PlasmaExtras.Representation { id: list model: historyModel currentIndex: -1 + topMargin: PlasmaCore.Units.smallSpacing * 2 bottomMargin: PlasmaCore.Units.smallSpacing * 2 + leftMargin: PlasmaCore.Units.smallSpacing * 2 + rightMargin: PlasmaCore.Units.smallSpacing * 2 spacing: PlasmaCore.Units.smallSpacing Keys.onDeletePressed: { @@ -355,7 +354,7 @@ PlasmaExtras.Representation { delegate: DraggableDelegate { id: delegate - width: ListView.view.width - (scrollView.PlasmaComponents3.ScrollBar.vertical.visible ? PlasmaCore.Units.smallSpacing * 4 : 0) + width: ListView.view.width - PlasmaCore.Units.smallSpacing * 4 contentItem: delegateLoader draggable: !model.isGroup && model.type != NotificationManager.Notifications.JobType