From 2a5abfdb01f6dc78d275895322bc7ae961f01b27 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 25 Jan 2022 18:53:52 +0100 Subject: [PATCH] Downgrade UM version, re-implementing scroll bar This plug-in needs to be compatible with Cura 4.9 and up, which means we can't use UM.ScrollBar. Contributes to issue CURA-8686. --- .../DigitalLibrary/resources/qml/Table.qml | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/plugins/DigitalLibrary/resources/qml/Table.qml b/plugins/DigitalLibrary/resources/qml/Table.qml index cb4ca1fe37..6eec4d4090 100644 --- a/plugins/DigitalLibrary/resources/qml/Table.qml +++ b/plugins/DigitalLibrary/resources/qml/Table.qml @@ -5,7 +5,7 @@ import Qt.labs.qmlmodels 1.0 import QtQuick 2.15 import QtQuick.Controls 2.15 -import UM 1.5 as UM +import UM 1.2 as UM /* * A re-sizeable table of data. @@ -109,7 +109,29 @@ Item } clip: true - ScrollBar.vertical: UM.ScrollBar {} + ScrollBar.vertical: ScrollBar + { + // Vertical ScrollBar, styled similarly to the scrollBar in the settings panel + id: verticalScrollBar + visible: flickableView.contentHeight > flickableView.height + + background: Rectangle + { + implicitWidth: UM.Theme.getSize("scrollbar").width + radius: Math.round(implicitWidth / 2) + color: UM.Theme.getColor("scrollbar_background") + } + + contentItem: Rectangle + { + id: scrollViewHandle + implicitWidth: UM.Theme.getSize("scrollbar").width + radius: Math.round(implicitWidth / 2) + + color: verticalScrollBar.pressed ? UM.Theme.getColor("scrollbar_handle_down") : verticalScrollBar.hovered ? UM.Theme.getColor("scrollbar_handle_hover") : UM.Theme.getColor("scrollbar_handle") + Behavior on color { ColorAnimation { duration: 50; } } + } + } columnWidthProvider: function(column) { return headerBar.children[column].width; //Cells get the same width as their column header.