Get rid of double scrollbar due to flickable in scrollview

The tutorials say it should work, but it doesn't. Now we make the whole thing a flickable with an attached textarea property, which does seem to work.

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-17 19:21:14 +01:00
parent 7f0af55d1d
commit d4381a6dd0
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -11,39 +11,38 @@ import Cura 1.1 as Cura
// //
// Cura-style TextArea with scrolls // Cura-style TextArea with scrolls
// //
ScrollView Flickable
{ {
id: scrollableTextAreaBase id: scrollableTextAreaBase
property alias textArea: _textArea property bool do_borders: true
property var back_color: UM.Theme.getColor("main_background") property var back_color: UM.Theme.getColor("main_background")
property var do_borders: true property alias textArea: flickableTextArea
clip: true ScrollBar.vertical: UM.ScrollBar {}
ScrollBar.vertical: UM.ScrollBar
TextArea.flickable: TextArea
{ {
parent: scrollableTextAreaBase id: flickableTextArea
anchors
background: Rectangle //Providing the background color and border.
{ {
right: parent.right anchors
rightMargin: parent.background.border.width {
top: parent.top top: parent.top
topMargin: anchors.rightMargin topMargin: -border.width
bottom: parent.bottom bottom: parent.bottom
bottomMargin: anchors.rightMargin bottomMargin: -border.width
left: parent.left
leftMargin: -border.width
right: parent.right
rightMargin: -border.width
}
color: scrollableTextAreaBase.back_color
border.color: UM.Theme.getColor("thick_lining")
border.width: scrollableTextAreaBase.do_borders ? UM.Theme.getSize("default_lining").width : 0
} }
}
background: Rectangle // Border
{
color: back_color
border.color: UM.Theme.getColor("thick_lining")
border.width: do_borders ? UM.Theme.getSize("default_lining").width : 0
}
TextArea
{
id: _textArea
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
textFormat: TextEdit.PlainText textFormat: TextEdit.PlainText
@ -51,4 +50,4 @@ ScrollView
wrapMode: Text.Wrap wrapMode: Text.Wrap
selectByMouse: true selectByMouse: true
} }
} }