Replace ScrollView with QtControls2 ListView

I can't update the buttons (not part of this ticket) so I kept those Controls1.
The ScrollView is no longer necessary, just a ListView now with customised scroll bar.

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-18 14:45:43 +01:00
parent d4381a6dd0
commit f630b84788
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -1,9 +1,10 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2 as OldControls
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QtQuick.Controls 2.15
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -76,7 +77,7 @@ Item
id: meshTypeButtons id: meshTypeButtons
spacing: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width
Button OldControls.Button
{ {
id: normalButton id: normalButton
text: catalog.i18nc("@label", "Normal model") text: catalog.i18nc("@label", "Normal model")
@ -88,7 +89,7 @@ Item
z: 4 z: 4
} }
Button OldControls.Button
{ {
id: supportMeshButton id: supportMeshButton
text: catalog.i18nc("@label", "Print as support") text: catalog.i18nc("@label", "Print as support")
@ -100,7 +101,7 @@ Item
z: 3 z: 3
} }
Button OldControls.Button
{ {
id: overlapMeshButton id: overlapMeshButton
text: catalog.i18nc("@label", "Modify settings for overlaps") text: catalog.i18nc("@label", "Modify settings for overlaps")
@ -112,7 +113,7 @@ Item
z: 2 z: 2
} }
Button OldControls.Button
{ {
id: antiOverhangMeshButton id: antiOverhangMeshButton
text: catalog.i18nc("@label", "Don't support overlaps") text: catalog.i18nc("@label", "Don't support overlaps")
@ -179,15 +180,14 @@ Item
height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight) height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight)
visible: currentMeshType != "anti_overhang_mesh" visible: currentMeshType != "anti_overhang_mesh"
ScrollView
{
height: parent.height
width: UM.Theme.getSize("setting").width + UM.Theme.getSize("default_margin").width
style: UM.Theme.styles.scrollview
ListView ListView
{ {
id: contents id: contents
height: parent.height
width: UM.Theme.getSize("setting").width + UM.Theme.getSize("default_margin").width
ScrollBar.vertical: UM.ScrollBar {}
clip: true
spacing: UM.Theme.getSize("default_lining").height spacing: UM.Theme.getSize("default_lining").height
model: UM.SettingDefinitionsModel model: UM.SettingDefinitionsModel
@ -285,7 +285,7 @@ Item
} }
} }
Button OldControls.Button
{ {
width: Math.round(UM.Theme.getSize("setting").height / 2) width: Math.round(UM.Theme.getSize("setting").height / 2)
height: UM.Theme.getSize("setting").height height: UM.Theme.getSize("setting").height
@ -368,7 +368,6 @@ Item
} }
} }
} }
}
Cura.SecondaryButton Cura.SecondaryButton
{ {