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.
This commit is contained in:
Ghostkeeper 2022-01-18 18:22:49 +01:00
parent ae81b5e3e7
commit 7a1578cbc4
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -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