mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 08:19:02 +08:00
Make sure that printer name is not empty
CURA-6435
This commit is contained in:
parent
b269dc95b0
commit
b0fd6628a5
@ -32,6 +32,7 @@ Item
|
||||
|
||||
// User-editable printer name
|
||||
property alias printerName: printerNameTextField.text
|
||||
property alias isPrinterNameValid: printerNameTextField.acceptableInput
|
||||
|
||||
onCurrentItemChanged:
|
||||
{
|
||||
@ -211,6 +212,10 @@ Item
|
||||
id: printerNameTextField
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: (parent.width / 2) | 0
|
||||
placeholderText: catalog.i18nc("@text", "Please give your printer a name")
|
||||
|
||||
// Make sure that the fill is not empty
|
||||
validator: RegExpValidator { regExp: /.+/ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,10 @@ Item
|
||||
}
|
||||
else
|
||||
{
|
||||
return addLocalPrinterDropDown.contentItem.currentItem != null
|
||||
// Printer name cannot be empty
|
||||
const localPrinterItem = addLocalPrinterDropDown.contentItem.currentItem
|
||||
const isPrinterNameValid = addLocalPrinterDropDown.contentItem.isPrinterNameValid
|
||||
return localPrinterItem != null && isPrinterNameValid
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,11 +37,28 @@ TextField
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_disabled_border")
|
||||
}
|
||||
if (!textField.acceptableInput)
|
||||
{
|
||||
return UM.Theme.getColor("setting_validation_error")
|
||||
}
|
||||
if (textField.hovered || textField.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_border_highlight")
|
||||
}
|
||||
return UM.Theme.getColor("setting_control_border")
|
||||
}
|
||||
|
||||
color:
|
||||
{
|
||||
if (!textField.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_control_disabled")
|
||||
}
|
||||
if (!textField.acceptableInput)
|
||||
{
|
||||
return UM.Theme.getColor("setting_validation_error_background")
|
||||
}
|
||||
return UM.Theme.getColor("setting_control")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user