mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-10 23:59:01 +08:00
Layout & code style: move unit into numeric textfield component
This commit is contained in:
parent
7bad718823
commit
c89669e73e
@ -87,7 +87,7 @@ Cura.MachineAction
|
|||||||
|
|
||||||
Grid
|
Grid
|
||||||
{
|
{
|
||||||
columns: 3
|
columns: 2
|
||||||
columnSpacing: UM.Theme.getSize("default_margin").width
|
columnSpacing: UM.Theme.getSize("default_margin").width
|
||||||
rowSpacing: UM.Theme.getSize("default_lining").width
|
rowSpacing: UM.Theme.getSize("default_lining").width
|
||||||
|
|
||||||
@ -95,67 +95,39 @@ Cura.MachineAction
|
|||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "X (Width)")
|
text: catalog.i18nc("@label", "X (Width)")
|
||||||
}
|
}
|
||||||
TextField
|
Loader
|
||||||
{
|
{
|
||||||
id: buildAreaWidthField
|
id: buildAreaWidthField
|
||||||
text: machineWidthProvider.properties.value
|
sourceComponent: numericTextFieldWithUnit
|
||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
property var propertyProvider: machineWidthProvider
|
||||||
onEditingFinished:
|
property string unit: catalog.i18nc("@label", "mm")
|
||||||
{
|
property bool forceUpdateOnChange: true
|
||||||
if (text != machineWidthProvider.properties.value)
|
|
||||||
{
|
|
||||||
machineWidthProvider.setPropertyValue("value", text);
|
|
||||||
manager.forceUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Y (Depth)")
|
text: catalog.i18nc("@label", "Y (Depth)")
|
||||||
}
|
}
|
||||||
TextField
|
Loader
|
||||||
{
|
{
|
||||||
id: buildAreaDepthField
|
id: buildAreaDepthField
|
||||||
text: machineDepthProvider.properties.value
|
sourceComponent: numericTextFieldWithUnit
|
||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
property var propertyProvider: machineDepthProvider
|
||||||
onEditingFinished: {
|
property string unit: catalog.i18nc("@label", "mm")
|
||||||
if (text != machineDepthProvider.properties.value)
|
property bool forceUpdateOnChange: true
|
||||||
{
|
|
||||||
machineDepthProvider.setPropertyValue("value", text);
|
|
||||||
manager.forceUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Z (Height)")
|
text: catalog.i18nc("@label", "Z (Height)")
|
||||||
}
|
}
|
||||||
TextField
|
Loader
|
||||||
{
|
{
|
||||||
id: buildAreaHeightField
|
id: buildAreaHeightField
|
||||||
text: machineHeightProvider.properties.value
|
sourceComponent: numericTextFieldWithUnit
|
||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
property var propertyProvider: machineHeightProvider
|
||||||
onEditingFinished: {
|
property string unit: catalog.i18nc("@label", "mm")
|
||||||
if (text != machineHeightProvider.properties.value)
|
property bool forceUpdateOnChange: true
|
||||||
{
|
|
||||||
machineHeightProvider.setPropertyValue("value", text);
|
|
||||||
manager.forceUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +270,7 @@ Cura.MachineAction
|
|||||||
|
|
||||||
Grid
|
Grid
|
||||||
{
|
{
|
||||||
columns: 3
|
columns: 2
|
||||||
columnSpacing: UM.Theme.getSize("default_margin").width
|
columnSpacing: UM.Theme.getSize("default_margin").width
|
||||||
rowSpacing: UM.Theme.getSize("default_lining").width
|
rowSpacing: UM.Theme.getSize("default_lining").width
|
||||||
|
|
||||||
@ -313,10 +285,6 @@ Cura.MachineAction
|
|||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
||||||
onEditingFinished: setHeadPolygon()
|
onEditingFinished: setHeadPolygon()
|
||||||
}
|
}
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@ -329,10 +297,6 @@ Cura.MachineAction
|
|||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
||||||
onEditingFinished: setHeadPolygon()
|
onEditingFinished: setHeadPolygon()
|
||||||
}
|
}
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@ -345,10 +309,6 @@ Cura.MachineAction
|
|||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
||||||
onEditingFinished: setHeadPolygon()
|
onEditingFinished: setHeadPolygon()
|
||||||
}
|
}
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
@ -361,12 +321,7 @@ Cura.MachineAction
|
|||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
||||||
onEditingFinished: setHeadPolygon()
|
onEditingFinished: setHeadPolygon()
|
||||||
}
|
}
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
|
||||||
|
|
||||||
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
|
||||||
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
||||||
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
||||||
|
|
||||||
@ -374,19 +329,15 @@ Cura.MachineAction
|
|||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Gantry height")
|
text: catalog.i18nc("@label", "Gantry height")
|
||||||
}
|
}
|
||||||
TextField
|
Loader
|
||||||
{
|
{
|
||||||
id: gantryHeightField
|
id: gantryHeightField
|
||||||
text: gantryHeightProvider.properties.value
|
sourceComponent: numericTextFieldWithUnit
|
||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
property var propertyProvider: gantryHeightProvider
|
||||||
onEditingFinished: { gantryHeightProvider.setPropertyValue("value", text) }
|
property string unit: catalog.i18nc("@label", "mm")
|
||||||
}
|
property bool forceUpdateOnChange: false
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
|
||||||
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
||||||
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height }
|
||||||
|
|
||||||
@ -441,7 +392,6 @@ Cura.MachineAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item { width: UM.Theme.getSize("default_margin").width; height: UM.Theme.getSize("default_margin").height; visible: extruderCountComboBox.visible }
|
|
||||||
|
|
||||||
|
|
||||||
Label
|
Label
|
||||||
@ -449,18 +399,14 @@ Cura.MachineAction
|
|||||||
text: catalog.i18nc("@label", "Nozzle size")
|
text: catalog.i18nc("@label", "Nozzle size")
|
||||||
visible: nozzleSizeField.visible
|
visible: nozzleSizeField.visible
|
||||||
}
|
}
|
||||||
TextField
|
Loader
|
||||||
{
|
{
|
||||||
id: nozzleSizeField
|
id: nozzleSizeField
|
||||||
text: machineNozzleSizeProvider.properties.value
|
|
||||||
visible: !Cura.MachineManager.hasVariants && machineExtruderCountProvider.properties.value == 1
|
visible: !Cura.MachineManager.hasVariants && machineExtruderCountProvider.properties.value == 1
|
||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
sourceComponent: numericTextFieldWithUnit
|
||||||
onEditingFinished: { machineNozzleSizeProvider.setPropertyValue("value", text) }
|
property var propertyProvider: machineNozzleSizeProvider
|
||||||
}
|
property string unit: catalog.i18nc("@label", "mm")
|
||||||
Label
|
property bool forceUpdateOnChange: false
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
visible: nozzleSizeField.visible
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,57 +502,49 @@ Cura.MachineAction
|
|||||||
|
|
||||||
Grid
|
Grid
|
||||||
{
|
{
|
||||||
columns: 3
|
columns: 2
|
||||||
columnSpacing: UM.Theme.getSize("default_margin").width
|
columnSpacing: UM.Theme.getSize("default_margin").width
|
||||||
rowSpacing: UM.Theme.getSize("default_lining").width
|
rowSpacing: UM.Theme.getSize("default_lining").width
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Nozzle size")
|
text: catalog.i18nc("@label", "Nozzle size")
|
||||||
|
visible: extruderNozzleSizeField.visible
|
||||||
}
|
}
|
||||||
TextField
|
Loader
|
||||||
{
|
{
|
||||||
id: extruderNozzleSizeField
|
id: extruderNozzleSizeField
|
||||||
text: extruderNozzleSizeProvider.properties.value
|
visible: !Cura.MachineManager.hasVariants
|
||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
sourceComponent: numericTextFieldWithUnit
|
||||||
onEditingFinished: { extruderNozzleSizeProvider.setPropertyValue("value", text) }
|
property var propertyProvider: extruderNozzleSizeProvider
|
||||||
}
|
property string unit: catalog.i18nc("@label", "mm")
|
||||||
Label
|
property bool forceUpdateOnChange: false
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Nozzle offset X")
|
text: catalog.i18nc("@label", "Nozzle offset X")
|
||||||
}
|
}
|
||||||
TextField
|
Loader
|
||||||
{
|
{
|
||||||
id: extruderOffsetXField
|
id: extruderOffsetXField
|
||||||
text: extruderOffsetXProvider.properties.value
|
sourceComponent: numericTextFieldWithUnit
|
||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
property var propertyProvider: extruderOffsetXProvider
|
||||||
onEditingFinished: { extruderOffsetXProvider.setPropertyValue("value", text) }
|
property string unit: catalog.i18nc("@label", "mm")
|
||||||
}
|
property bool forceUpdateOnChange: false
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Nozzle offset Y")
|
text: catalog.i18nc("@label", "Nozzle offset Y")
|
||||||
}
|
}
|
||||||
TextField
|
Loader
|
||||||
{
|
{
|
||||||
id: extruderOffsetYField
|
id: extruderOffsetYField
|
||||||
text: extruderOffsetYProvider.properties.value
|
sourceComponent: numericTextFieldWithUnit
|
||||||
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
property var propertyProvider: extruderOffsetYProvider
|
||||||
onEditingFinished: { extruderOffsetYProvider.setPropertyValue("value", text) }
|
property string unit: catalog.i18nc("@label", "mm")
|
||||||
|
property bool forceUpdateOnChange: false
|
||||||
}
|
}
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@label", "mm")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row
|
Row
|
||||||
@ -701,6 +639,40 @@ Cura.MachineAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component
|
||||||
|
{
|
||||||
|
id: numericTextFieldWithUnit
|
||||||
|
Item {
|
||||||
|
height: textField.height
|
||||||
|
width: textField.width
|
||||||
|
TextField
|
||||||
|
{
|
||||||
|
id: textField
|
||||||
|
text: propertyProvider.properties.value
|
||||||
|
validator: RegExpValidator { regExp: /[0-9\.]{0,6}/ }
|
||||||
|
onEditingFinished:
|
||||||
|
{
|
||||||
|
if (propertyProvider && text != propertyProvider.properties.value)
|
||||||
|
{
|
||||||
|
propertyProvider.setPropertyValue("value", text);
|
||||||
|
if(forceUpdateOnChange)
|
||||||
|
{
|
||||||
|
manager.forceUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: unit
|
||||||
|
anchors.right: textField.right
|
||||||
|
anchors.rightMargin: y - textField.y
|
||||||
|
anchors.verticalCenter: textField.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: machineWidthProvider
|
id: machineWidthProvider
|
||||||
|
Loading…
x
Reference in New Issue
Block a user