mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-17 20:15:53 +08:00
Simplify materials preference page by wrapping scroll items in ListView
CURA-8979
This commit is contained in:
parent
c10865b179
commit
10339555f4
@ -515,7 +515,7 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView
|
ListView
|
||||||
{
|
{
|
||||||
id: settingsPage
|
id: settingsPage
|
||||||
visible: pageSelectorTabRow.currentItem.activeView === "settings"
|
visible: pageSelectorTabRow.currentItem.activeView === "settings"
|
||||||
@ -530,7 +530,9 @@ Item
|
|||||||
rightMargin: UM.Theme.getSize("thin_margin").width
|
rightMargin: UM.Theme.getSize("thin_margin").width
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
width: settingsPage.width
|
||||||
|
spacing: UM.Theme.getSize("narrow_margin").height
|
||||||
|
|
||||||
ScrollBar.vertical: UM.ScrollBar
|
ScrollBar.vertical: UM.ScrollBar
|
||||||
{
|
{
|
||||||
id: settingScrollBar
|
id: settingScrollBar
|
||||||
@ -545,91 +547,83 @@ Item
|
|||||||
|
|
||||||
property real columnWidth: Math.floor((width - settingScrollBar.width - UM.Theme.getSize("narrow_margin").width) / 2)
|
property real columnWidth: Math.floor((width - settingScrollBar.width - UM.Theme.getSize("narrow_margin").width) / 2)
|
||||||
|
|
||||||
Column
|
model: UM.SettingDefinitionsModel
|
||||||
{
|
{
|
||||||
width: settingsPage.width
|
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
|
||||||
spacing: UM.Theme.getSize("narrow_margin").height
|
visibilityHandler: Cura.MaterialSettingsVisibilityHandler { }
|
||||||
Repeater
|
expanded: ["*"]
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate: UM.TooltipArea
|
||||||
|
{
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
|
||||||
|
UM.TooltipArea
|
||||||
{
|
{
|
||||||
model: UM.SettingDefinitionsModel
|
anchors.fill: parent
|
||||||
|
text: model.description
|
||||||
|
}
|
||||||
|
UM.Label
|
||||||
|
{
|
||||||
|
id: label
|
||||||
|
width: settingsPage.columnWidth
|
||||||
|
height: spinBox.height + UM.Theme.getSize("default_lining").height
|
||||||
|
text: model.label
|
||||||
|
elide: Text.ElideRight
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
Cura.SpinBox
|
||||||
|
{
|
||||||
|
id: spinBox
|
||||||
|
anchors.left: label.right
|
||||||
|
value:
|
||||||
{
|
{
|
||||||
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
|
// In case the setting is not in the material...
|
||||||
visibilityHandler: Cura.MaterialSettingsVisibilityHandler { }
|
if (!isNaN(parseFloat(materialPropertyProvider.properties.value)))
|
||||||
expanded: ["*"]
|
{
|
||||||
|
return parseFloat(materialPropertyProvider.properties.value);
|
||||||
|
}
|
||||||
|
// ... we search in the variant, and if it is not there...
|
||||||
|
if (!isNaN(parseFloat(variantPropertyProvider.properties.value)))
|
||||||
|
{
|
||||||
|
return parseFloat(variantPropertyProvider.properties.value);
|
||||||
|
}
|
||||||
|
// ... then look in the definition container.
|
||||||
|
if (!isNaN(parseFloat(machinePropertyProvider.properties.value)))
|
||||||
|
{
|
||||||
|
return parseFloat(machinePropertyProvider.properties.value);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
width: settingsPage.columnWidth
|
||||||
|
suffix: " " + model.unit
|
||||||
|
to: 99999
|
||||||
|
decimals: model.unit == "mm" ? 2 : 0
|
||||||
|
|
||||||
delegate: UM.TooltipArea
|
onEditingFinished: materialPropertyProvider.setPropertyValue("value", value)
|
||||||
{
|
}
|
||||||
width: childrenRect.width
|
|
||||||
height: childrenRect.height
|
|
||||||
|
|
||||||
UM.TooltipArea
|
UM.ContainerPropertyProvider
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
id: materialPropertyProvider
|
||||||
text: model.description
|
containerId: base.containerId
|
||||||
}
|
watchedProperties: [ "value" ]
|
||||||
UM.Label
|
key: model.key
|
||||||
{
|
}
|
||||||
id: label
|
UM.ContainerPropertyProvider
|
||||||
width: settingsPage.columnWidth
|
{
|
||||||
height: spinBox.height + UM.Theme.getSize("default_lining").height
|
id: variantPropertyProvider
|
||||||
text: model.label
|
containerId: Cura.MachineManager.activeStack.variant.id
|
||||||
elide: Text.ElideRight
|
watchedProperties: [ "value" ]
|
||||||
verticalAlignment: Qt.AlignVCenter
|
key: model.key
|
||||||
}
|
}
|
||||||
Cura.SpinBox
|
UM.ContainerPropertyProvider
|
||||||
{
|
{
|
||||||
id: spinBox
|
id: machinePropertyProvider
|
||||||
anchors.left: label.right
|
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
|
||||||
value:
|
watchedProperties: ["value"]
|
||||||
{
|
key: model.key
|
||||||
// In case the setting is not in the material...
|
|
||||||
if (!isNaN(parseFloat(materialPropertyProvider.properties.value)))
|
|
||||||
{
|
|
||||||
return parseFloat(materialPropertyProvider.properties.value);
|
|
||||||
}
|
|
||||||
// ... we search in the variant, and if it is not there...
|
|
||||||
if (!isNaN(parseFloat(variantPropertyProvider.properties.value)))
|
|
||||||
{
|
|
||||||
return parseFloat(variantPropertyProvider.properties.value);
|
|
||||||
}
|
|
||||||
// ... then look in the definition container.
|
|
||||||
if (!isNaN(parseFloat(machinePropertyProvider.properties.value)))
|
|
||||||
{
|
|
||||||
return parseFloat(machinePropertyProvider.properties.value);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
width: settingsPage.columnWidth
|
|
||||||
suffix: " " + model.unit
|
|
||||||
to: 99999
|
|
||||||
decimals: model.unit == "mm" ? 2 : 0
|
|
||||||
|
|
||||||
onEditingFinished: materialPropertyProvider.setPropertyValue("value", value)
|
|
||||||
}
|
|
||||||
|
|
||||||
UM.ContainerPropertyProvider
|
|
||||||
{
|
|
||||||
id: materialPropertyProvider
|
|
||||||
containerId: base.containerId
|
|
||||||
watchedProperties: [ "value" ]
|
|
||||||
key: model.key
|
|
||||||
}
|
|
||||||
UM.ContainerPropertyProvider
|
|
||||||
{
|
|
||||||
id: variantPropertyProvider
|
|
||||||
containerId: Cura.MachineManager.activeStack.variant.id
|
|
||||||
watchedProperties: [ "value" ]
|
|
||||||
key: model.key
|
|
||||||
}
|
|
||||||
UM.ContainerPropertyProvider
|
|
||||||
{
|
|
||||||
id: machinePropertyProvider
|
|
||||||
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
|
|
||||||
watchedProperties: ["value"]
|
|
||||||
key: model.key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user