Browse Source

Re-use component scrollbar from Uranium

It's a new component so that we don't have to re-implement it everywhere. In this case we do have to anchor it correctly though because ScrollView doesn't do that by itself.

Contributes to issue CURA-8686.
Ghostkeeper 3 years ago
parent
commit
7a1578cbc4
1 changed files with 10 additions and 14 deletions
  1. 10 14
      resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml

+ 10 - 14
resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml

@@ -1,10 +1,10 @@
-// Copyright (c) 2018 Ultimaker B.V.
+// Copyright (c) 2022 Ultimaker B.V.
 // Cura is released under the terms of the LGPLv3 or higher.
 
 import QtQuick 2.7
 import QtQuick.Controls 2.3
 
-import UM 1.4 as UM
+import UM 1.5 as UM
 import Cura 1.0 as Cura
 
 Item
@@ -67,18 +67,14 @@ Item
         contentHeight: configurationList.height
         clip: true
 
-        ScrollBar.vertical.policy: (configurationList.height > maximumHeight) ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff //The AsNeeded policy also hides it when the cursor is away, and we don't want that.
-        ScrollBar.vertical.background: Rectangle
-        {
-            implicitWidth: UM.Theme.getSize("scrollbar").width
-            radius: width / 2
-            color: UM.Theme.getColor("scrollbar_background")
-        }
-        ScrollBar.vertical.contentItem: Rectangle
-        {
-            implicitWidth: UM.Theme.getSize("scrollbar").width
-            radius: width / 2
-            color: UM.Theme.getColor(parent.pressed ? "scrollbar_handle_down" : parent.hovered ? "scrollbar_handle_hover" : "scrollbar_handle")
+        ScrollBar.vertical: UM.ScrollBar {
+            parent: container
+            anchors
+            {
+                top: parent.top
+                right: parent.right
+                bottom: parent.bottom
+            }
         }
 
         ButtonGroup