From 783da20117857dbc840b9863f2cb4227773b338c Mon Sep 17 00:00:00 2001
From: J-P Nurmi <jpnurmi@gmail.com>
Date: Wed, 2 Apr 2014 15:04:11 +0200
Subject: [PATCH] Improve scrollbars on touch

Hide the scrollbar background which makes it look like a desktop
scrollbar. Scrollbars are now by default non-interactive on touch.

[ChangeLog][QtQuickControls][ScrollView] Scrollbars are now
non-interactive on mobile/touch devices.

Task-number: QTBUG-37387
Change-Id: I63b6db9309a6e33140de0d26c8d4fd3e1bcfb832
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
---
 src/controls/Private/ScrollBar.qml           | 3 ++-
 src/controls/Styles/Base/ScrollViewStyle.qml | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/controls/Private/ScrollBar.qml b/src/controls/Private/ScrollBar.qml
index 65ed51cfc..1734e4961 100644
--- a/src/controls/Private/ScrollBar.qml
+++ b/src/controls/Private/ScrollBar.qml
@@ -101,7 +101,8 @@ Item {
         onEntered: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY)
         onExited: if (!pressed) __panel.activeControl = "none"
         onMouseXChanged: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY)
-        hoverEnabled: true
+        hoverEnabled: !Settings.hasTouchScreen
+        enabled: !Settings.hasTouchScreen // TODO: touch on desktop?
 
         property var pressedX
         property var pressedY
diff --git a/src/controls/Styles/Base/ScrollViewStyle.qml b/src/controls/Styles/Base/ScrollViewStyle.qml
index a7dbcc520..1944ed43d 100644
--- a/src/controls/Styles/Base/ScrollViewStyle.qml
+++ b/src/controls/Styles/Base/ScrollViewStyle.qml
@@ -117,7 +117,7 @@ Style {
         implicitHeight: Math.round(TextSingleton.implicitHeight)
         clip: true
         opacity: transientScrollBars ? 0.5 : 1.0
-        visible: !transientScrollBars || sticky
+        visible: !Settings.hasTouchScreen && (!transientScrollBars || sticky)
         Rectangle {
             anchors.fill: parent
             color: "#ddd"
-- 
GitLab