mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 23:05:57 +08:00
Use TabRow for material page selection
The contents of the page is done with a simple page that becomes visible or not. The easiest solution I could think of. No StackLayout necessary here. Contributes to issue CURA-8686.
This commit is contained in:
parent
cfafdf878a
commit
2758957d5c
@ -11,7 +11,7 @@ import Cura 1.0 as Cura
|
|||||||
|
|
||||||
import ".." // Access to ReadOnlyTextArea.qml
|
import ".." // Access to ReadOnlyTextArea.qml
|
||||||
|
|
||||||
OldControls.TabView
|
Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
|
|
||||||
@ -68,20 +68,35 @@ OldControls.TabView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OldControls.Tab
|
UM.TabRow
|
||||||
{
|
{
|
||||||
title: catalog.i18nc("@title", "Information")
|
id: pageSelectorTabRow
|
||||||
|
UM.TabRowButton
|
||||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
{
|
||||||
|
text: catalog.i18nc("@title", "Information")
|
||||||
|
property string activeView: "information" //To determine which page gets displayed.
|
||||||
|
}
|
||||||
|
UM.TabRowButton
|
||||||
|
{
|
||||||
|
text: catalog.i18nc("@label", "Print settings")
|
||||||
|
property string activeView: "settings"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ScrollView
|
ScrollView
|
||||||
{
|
{
|
||||||
id: scrollView
|
id: informationPage
|
||||||
anchors.fill: parent
|
anchors
|
||||||
|
{
|
||||||
|
top: pageSelectorTabRow.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
|
||||||
ScrollBar.vertical: UM.ScrollBar
|
ScrollBar.vertical: UM.ScrollBar
|
||||||
{
|
{
|
||||||
parent: scrollView
|
parent: informationPage
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
@ -91,8 +106,9 @@ OldControls.TabView
|
|||||||
}
|
}
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
clip: true
|
clip: true
|
||||||
|
visible: pageSelectorTabRow.currentItem.activeView === "information"
|
||||||
|
|
||||||
property real columnWidth: (scrollView.width * 0.5 - UM.Theme.getSize("default_margin").width) | 0
|
property real columnWidth: (width * 0.5 - UM.Theme.getSize("default_margin").width) | 0
|
||||||
|
|
||||||
Flow
|
Flow
|
||||||
{
|
{
|
||||||
@ -136,40 +152,40 @@ OldControls.TabView
|
|||||||
onRejected: no()
|
onRejected: no()
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Display Name") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Display Name") }
|
||||||
ReadOnlyTextField
|
ReadOnlyTextField
|
||||||
{
|
{
|
||||||
id: displayNameTextField;
|
id: displayNameTextField;
|
||||||
width: scrollView.columnWidth;
|
width: informationPage.columnWidth;
|
||||||
text: properties.name;
|
text: properties.name;
|
||||||
readOnly: !base.editingEnabled;
|
readOnly: !base.editingEnabled;
|
||||||
onEditingFinished: base.updateMaterialDisplayName(properties.name, text)
|
onEditingFinished: base.updateMaterialDisplayName(properties.name, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Brand") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Brand") }
|
||||||
ReadOnlyTextField
|
ReadOnlyTextField
|
||||||
{
|
{
|
||||||
id: brandTextField;
|
id: brandTextField;
|
||||||
width: scrollView.columnWidth;
|
width: informationPage.columnWidth;
|
||||||
text: properties.brand;
|
text: properties.brand;
|
||||||
readOnly: !base.editingEnabled;
|
readOnly: !base.editingEnabled;
|
||||||
onEditingFinished: base.updateMaterialBrand(properties.brand, text)
|
onEditingFinished: base.updateMaterialBrand(properties.brand, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") }
|
||||||
ReadOnlyTextField
|
ReadOnlyTextField
|
||||||
{
|
{
|
||||||
id: materialTypeField;
|
id: materialTypeField;
|
||||||
width: scrollView.columnWidth;
|
width: informationPage.columnWidth;
|
||||||
text: properties.material;
|
text: properties.material;
|
||||||
readOnly: !base.editingEnabled;
|
readOnly: !base.editingEnabled;
|
||||||
onEditingFinished: base.updateMaterialType(properties.material, text)
|
onEditingFinished: base.updateMaterialType(properties.material, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Color") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Color") }
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
width: scrollView.columnWidth
|
width: informationPage.columnWidth
|
||||||
height: parent.rowHeight
|
height: parent.rowHeight
|
||||||
spacing: Math.round(UM.Theme.getSize("default_margin").width / 2)
|
spacing: Math.round(UM.Theme.getSize("default_margin").width / 2)
|
||||||
|
|
||||||
@ -218,11 +234,11 @@ OldControls.TabView
|
|||||||
|
|
||||||
Label { width: parent.width; height: parent.rowHeight; font.bold: true; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Properties") }
|
Label { width: parent.width; height: parent.rowHeight; font.bold: true; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Properties") }
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Density") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Density") }
|
||||||
ReadOnlySpinBox
|
ReadOnlySpinBox
|
||||||
{
|
{
|
||||||
id: densitySpinBox
|
id: densitySpinBox
|
||||||
width: scrollView.columnWidth
|
width: informationPage.columnWidth
|
||||||
value: properties.density
|
value: properties.density
|
||||||
decimals: 2
|
decimals: 2
|
||||||
suffix: " g/cm³"
|
suffix: " g/cm³"
|
||||||
@ -233,11 +249,11 @@ OldControls.TabView
|
|||||||
onValueChanged: updateCostPerMeter()
|
onValueChanged: updateCostPerMeter()
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Diameter") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Diameter") }
|
||||||
ReadOnlySpinBox
|
ReadOnlySpinBox
|
||||||
{
|
{
|
||||||
id: diameterSpinBox
|
id: diameterSpinBox
|
||||||
width: scrollView.columnWidth
|
width: informationPage.columnWidth
|
||||||
value: properties.diameter
|
value: properties.diameter
|
||||||
decimals: 2
|
decimals: 2
|
||||||
suffix: " mm"
|
suffix: " mm"
|
||||||
@ -267,11 +283,11 @@ OldControls.TabView
|
|||||||
onValueChanged: updateCostPerMeter()
|
onValueChanged: updateCostPerMeter()
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament Cost") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament Cost") }
|
||||||
OldControls.SpinBox
|
OldControls.SpinBox
|
||||||
{
|
{
|
||||||
id: spoolCostSpinBox
|
id: spoolCostSpinBox
|
||||||
width: scrollView.columnWidth
|
width: informationPage.columnWidth
|
||||||
value: base.getMaterialPreferenceValue(properties.guid, "spool_cost")
|
value: base.getMaterialPreferenceValue(properties.guid, "spool_cost")
|
||||||
prefix: base.currency + " "
|
prefix: base.currency + " "
|
||||||
decimals: 2
|
decimals: 2
|
||||||
@ -284,11 +300,11 @@ OldControls.TabView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament weight") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament weight") }
|
||||||
OldControls.SpinBox
|
OldControls.SpinBox
|
||||||
{
|
{
|
||||||
id: spoolWeightSpinBox
|
id: spoolWeightSpinBox
|
||||||
width: scrollView.columnWidth
|
width: informationPage.columnWidth
|
||||||
value: base.getMaterialPreferenceValue(properties.guid, "spool_weight", Cura.ContainerManager.getContainerMetaDataEntry(properties.container_id, "properties/weight"))
|
value: base.getMaterialPreferenceValue(properties.guid, "spool_weight", Cura.ContainerManager.getContainerMetaDataEntry(properties.container_id, "properties/weight"))
|
||||||
suffix: " g"
|
suffix: " g"
|
||||||
stepSize: 100
|
stepSize: 100
|
||||||
@ -302,19 +318,19 @@ OldControls.TabView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament length") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament length") }
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
width: scrollView.columnWidth
|
width: informationPage.columnWidth
|
||||||
text: "~ %1 m".arg(Math.round(base.spoolLength))
|
text: "~ %1 m".arg(Math.round(base.spoolLength))
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
height: parent.rowHeight
|
height: parent.rowHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Cost per Meter") }
|
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Cost per Meter") }
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
width: scrollView.columnWidth
|
width: informationPage.columnWidth
|
||||||
text: "~ %1 %2/m".arg(base.costPerMeter.toFixed(2)).arg(base.currency)
|
text: "~ %1 %2/m".arg(base.costPerMeter.toFixed(2)).arg(base.currency)
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
height: parent.rowHeight
|
height: parent.rowHeight
|
||||||
@ -323,7 +339,7 @@ OldControls.TabView
|
|||||||
Item { width: parent.width; height: UM.Theme.getSize("default_margin").height; visible: unlinkMaterialButton.visible }
|
Item { width: parent.width; height: UM.Theme.getSize("default_margin").height; visible: unlinkMaterialButton.visible }
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
width: 2 * scrollView.columnWidth
|
width: 2 * informationPage.columnWidth
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
text: catalog.i18nc("@label", "This material is linked to %1 and shares some of its properties.").arg(base.linkedMaterialNames)
|
text: catalog.i18nc("@label", "This material is linked to %1 and shares some of its properties.").arg(base.linkedMaterialNames)
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
@ -348,7 +364,7 @@ OldControls.TabView
|
|||||||
ReadOnlyTextArea
|
ReadOnlyTextArea
|
||||||
{
|
{
|
||||||
text: properties.description;
|
text: properties.description;
|
||||||
width: 2 * scrollView.columnWidth
|
width: 2 * informationPage.columnWidth
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
readOnly: !base.editingEnabled;
|
readOnly: !base.editingEnabled;
|
||||||
@ -361,7 +377,7 @@ OldControls.TabView
|
|||||||
ReadOnlyTextArea
|
ReadOnlyTextArea
|
||||||
{
|
{
|
||||||
text: properties.adhesion_info;
|
text: properties.adhesion_info;
|
||||||
width: 2 * scrollView.columnWidth
|
width: 2 * informationPage.columnWidth
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
readOnly: !base.editingEnabled;
|
readOnly: !base.editingEnabled;
|
||||||
@ -378,31 +394,26 @@ OldControls.TabView
|
|||||||
base.costPerMeter = calculateCostPerMeter(spoolCostSpinBox.value);
|
base.costPerMeter = calculateCostPerMeter(spoolCostSpinBox.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
OldControls.Tab
|
|
||||||
{
|
|
||||||
title: catalog.i18nc("@label", "Print settings")
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
leftMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
topMargin: UM.Theme.getSize("default_margin").height
|
|
||||||
bottomMargin: UM.Theme.getSize("default_margin").height
|
|
||||||
rightMargin: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView
|
ListView
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors
|
||||||
|
{
|
||||||
|
top: pageSelectorTabRow.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
|
||||||
model: UM.SettingDefinitionsModel
|
model: UM.SettingDefinitionsModel
|
||||||
{
|
{
|
||||||
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
|
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
|
||||||
visibilityHandler: Cura.MaterialSettingsVisibilityHandler { }
|
visibilityHandler: Cura.MaterialSettingsVisibilityHandler { }
|
||||||
expanded: ["*"]
|
expanded: ["*"]
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBar.vertical: UM.ScrollBar {}
|
ScrollBar.vertical: UM.ScrollBar {}
|
||||||
clip: true
|
clip: true
|
||||||
|
visible: pageSelectorTabRow.currentItem.activeView === "settings"
|
||||||
|
|
||||||
delegate: UM.TooltipArea
|
delegate: UM.TooltipArea
|
||||||
{
|
{
|
||||||
@ -473,7 +484,6 @@ OldControls.TabView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function calculateSpoolLength(diameter, density, spoolWeight)
|
function calculateSpoolLength(diameter, density, spoolWeight)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user