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.
This commit is contained in:
Ghostkeeper 2022-01-25 18:53:52 +01:00
parent c6eb1e668d
commit 2a5abfdb01
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -5,7 +5,7 @@ import Qt.labs.qmlmodels 1.0
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 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. * A re-sizeable table of data.
@ -109,7 +109,29 @@ Item
} }
clip: true 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) columnWidthProvider: function(column)
{ {
return headerBar.children[column].width; //Cells get the same width as their column header. return headerBar.children[column].width; //Cells get the same width as their column header.