Use custom scroll bar for object selector

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-19 17:59:41 +01:00
parent 796779316f
commit 08b8dcfa43
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -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,23 +99,22 @@ Item
ListView
{
id: listView
clip: true
anchors
{
left: parent.left
right: parent.right
top: parent.top
margins: UM.Theme.getSize("default_lining").width
}
ScrollBar.vertical: ScrollBar
{
hoverEnabled: true
}
property real maximumHeight: UM.Theme.getSize("objects_menu_size").height
height: Math.min(contentHeight, maximumHeight)
ScrollBar.vertical: UM.ScrollBar
{
id: scrollBar
}
clip: true
model: Cura.ObjectsModel {}
delegate: ObjectItemButton
@ -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