Browse Source

Use custom scroll bar for object selector

Contributes to issue CURA-8686.
Ghostkeeper 3 years ago
parent
commit
08b8dcfa43
1 changed files with 9 additions and 10 deletions
  1. 9 10
      resources/qml/ObjectSelector.qml

+ 9 - 10
resources/qml/ObjectSelector.qml

@@ -1,4 +1,4 @@
-// Copyright (c) 2020 Ultimaker B.V.
+// Copyright (c) 2022 Ultimaker B.V.
 // Cura is released under the terms of the LGPLv3 or higher.
 
 import QtQuick 2.10
@@ -76,7 +76,7 @@ Item
         id: contents
         width: parent.width
         visible: objectSelector.opened
-        height: visible ? listView.height : 0
+        height: visible ? listView.height + border.width * 2 : 0
         color: UM.Theme.getColor("main_background")
         border.width: UM.Theme.getSize("default_lining").width
         border.color: UM.Theme.getColor("lining")
@@ -99,22 +99,21 @@ Item
         ListView
         {
             id: listView
-            clip: true
             anchors
             {
                 left: parent.left
                 right: parent.right
+                top: parent.top
                 margins: UM.Theme.getSize("default_lining").width
             }
+            property real maximumHeight: UM.Theme.getSize("objects_menu_size").height
+            height: Math.min(contentHeight, maximumHeight)
 
-            ScrollBar.vertical: ScrollBar
+            ScrollBar.vertical: UM.ScrollBar
             {
-                hoverEnabled: true
+                id: scrollBar
             }
-
-            property real maximumHeight: UM.Theme.getSize("objects_menu_size").height
-
-            height: Math.min(contentHeight, maximumHeight)
+            clip: true
 
             model: Cura.ObjectsModel {}
 
@@ -128,7 +127,7 @@ Item
                     value: model.selected
                 }
                 text: model.name
-                width: listView.width
+                width: listView.width - scrollBar.width
                 property bool outsideBuildArea: model.outside_build_area
                 property int perObjectSettingsCount: model.per_object_settings_count
                 property string meshType: model.mesh_type