Replace ScrollView by ListView in settings picking dialogue

The ScrollView is no longer necessary in Controls2. Just have a ListView with customised scrollbar.

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

View file

@ -1,7 +1,10 @@
import QtQuick 2.2 // Copyright (c) 2022 Ultimaker B.V.
import QtQuick.Controls 1.2 // Cura is released under the terms of the LGPLv3 or higher.
import UM 1.2 as UM import QtQuick 2.2
import QtQuick.Controls 2.2
import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
import ".." import ".."
@ -67,10 +70,9 @@ UM.Dialog
text: catalog.i18nc("@label:checkbox", "Show all") text: catalog.i18nc("@label:checkbox", "Show all")
} }
ScrollView ListView
{ {
id: scrollView id: listview
anchors anchors
{ {
top: filterInput.bottom top: filterInput.bottom
@ -78,47 +80,47 @@ UM.Dialog
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
} }
ListView
ScrollBar.vertical: UM.ScrollBar {}
clip: true
model: UM.SettingDefinitionsModel
{ {
id: listview id: definitionsModel
model: UM.SettingDefinitionsModel containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
visibilityHandler: UM.SettingPreferenceVisibilityHandler {}
expanded: [ "*" ]
exclude:
{ {
id: definitionsModel var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings)
visibilityHandler: UM.SettingPreferenceVisibilityHandler {} return excluded_settings
expanded: [ "*" ]
exclude:
{
var excluded_settings = [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]
excluded_settings = excluded_settings.concat(settingPickDialog.additional_excluded_settings)
return excluded_settings
}
showAll: toggleShowAll.checked || filterInput.text !== ""
} }
delegate: Loader showAll: toggleShowAll.checked || filterInput.text !== ""
{
id: loader
width: listview.width
height: model.type != undefined ? UM.Theme.getSize("section").height : 0
property var definition: model
property var settingDefinitionsModel: definitionsModel
asynchronous: true
source:
{
switch(model.type)
{
case "category":
return "PerObjectCategory.qml"
default:
return "PerObjectItem.qml"
}
}
}
Component.onCompleted: settingPickDialog.updateFilter()
} }
delegate: Loader
{
id: loader
width: listview.width
height: model.type != undefined ? UM.Theme.getSize("section").height : 0
property var definition: model
property var settingDefinitionsModel: definitionsModel
asynchronous: true
source:
{
switch(model.type)
{
case "category":
return "PerObjectCategory.qml"
default:
return "PerObjectItem.qml"
}
}
}
Component.onCompleted: settingPickDialog.updateFilter()
} }
rightButtons: [ rightButtons: [