From 4779f9564a4ac2267a1af3a746eb94b3437355bf Mon Sep 17 00:00:00 2001 From: Eike Hein Date: Fri, 1 Dec 2017 23:33:23 +0900 Subject: [PATCH] Suppress unnecessary scroll indicators if the flickable is a ListView with known orientation Summary: ListView.atYEnd is notoriously buggy and sometimes will cause indicators to blink in and out of existence where not needed. Reviewers: #plasma, mart Subscribers: plasma-devel, #frameworks Tags: #plasma, #frameworks Differential Revision: https://phabricator.kde.org/D9089 --- .../plasmastyle/ScrollViewStyle.qml | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/declarativeimports/plasmastyle/ScrollViewStyle.qml b/src/declarativeimports/plasmastyle/ScrollViewStyle.qml index 77ea214ef..95760fccd 100644 --- a/src/declarativeimports/plasmastyle/ScrollViewStyle.qml +++ b/src/declarativeimports/plasmastyle/ScrollViewStyle.qml @@ -72,12 +72,19 @@ QtQuickControlStyle.ScrollViewStyle { } PlasmaCore.SvgItem { + visible: { + if (flickableItem.hasOwnProperty("orientation")) { + return (flickableItem.orientation === Qt.Vertical); + } + + return false; + } svg: borderSvg z: 1000 elementId: "border-top" width: 100 height: naturalSize.height - opacity: flickableItem.atYBeginning ? 0 : 1 + opacity: !visible || flickableItem.atYBeginning ? 0 : 1 Behavior on opacity { NumberAnimation { duration: units.longDuration @@ -91,12 +98,19 @@ QtQuickControlStyle.ScrollViewStyle { } } PlasmaCore.SvgItem { + visible: { + if (flickableItem.hasOwnProperty("orientation")) { + return (flickableItem.orientation === Qt.Vertical); + } + + return false; + } svg: borderSvg z: 1000 elementId: "border-bottom" width: 100 height: naturalSize.height - opacity: flickableItem.atYEnd ? 0 : 1 + opacity: !visible || flickableItem.atYEnd ? 0 : 1 Behavior on opacity { NumberAnimation { duration: units.longDuration @@ -110,11 +124,18 @@ QtQuickControlStyle.ScrollViewStyle { } } PlasmaCore.SvgItem { + visible: { + if (flickableItem.hasOwnProperty("orientation")) { + return (flickableItem.orientation === Qt.Horizontal); + } + + return false; + } svg: borderSvg z: 1000 elementId: "border-left" width: naturalSize.width - opacity: flickableItem.atXBeginning ? 0 : 1 + opacity: !visible || flickableItem.atXBeginning ? 0 : 1 Behavior on opacity { NumberAnimation { duration: units.longDuration @@ -128,11 +149,18 @@ QtQuickControlStyle.ScrollViewStyle { } } PlasmaCore.SvgItem { + visible: { + if (flickableItem.hasOwnProperty("orientation")) { + return (flickableItem.orientation === Qt.Horizontal); + } + + return false; + } svg: borderSvg z: 1000 elementId: "border-right" width: naturalSize.width - opacity: flickableItem.atXEnd ? 0 : 1 + opacity: !visible || flickableItem.atXEnd ? 0 : 1 Behavior on opacity { NumberAnimation { duration: units.longDuration