Use custom scroll bar for qualities+intents menu

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-19 14:47:55 +01:00
parent c57126fb00
commit 5041162a99
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. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
@ -43,17 +43,29 @@ Popup
// This repeater adds the intent labels // This repeater adds the intent labels
ScrollView ScrollView
{ {
id: qualityListScrollView
property real maximumHeight: screenScaleFactor * 400 property real maximumHeight: screenScaleFactor * 400
contentHeight: dataColumn.height contentHeight: dataColumn.height
height: Math.min(contentHeight, maximumHeight) height: Math.min(contentHeight, maximumHeight)
clip: true width: parent.width
ScrollBar.vertical.policy: height == maximumHeight ? ScrollBar.AlwaysOn: ScrollBar.AlwaysOff clip: true
ScrollBar.vertical: UM.ScrollBar
{
id: qualityListScrollBar
parent: qualityListScrollView
anchors
{
top: parent.top
right: parent.right
bottom: parent.bottom
}
}
Column Column
{ {
id: dataColumn id: dataColumn
width: parent.width width: qualityListScrollView.width - qualityListScrollBar.width
Repeater Repeater
{ {
model: dataModel model: dataModel
@ -64,7 +76,7 @@ Popup
property variant subItemModel: model.qualities property variant subItemModel: model.qualities
height: childrenRect.height height: childrenRect.height
width: popup.contentWidth width: dataColumn.width
UM.Label UM.Label
{ {
@ -137,7 +149,7 @@ Popup
Item Item
{ {
height: childrenRect.height height: childrenRect.height
width: popup.contentWidth width: dataColumn.width
UM.Label UM.Label
{ {