mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Add validators to project.
CURA-9793
This commit is contained in:
parent
522bf60e81
commit
487bf41a7b
@ -119,7 +119,7 @@ UM.Dialog
|
||||
text = `#${text}`;
|
||||
}
|
||||
}
|
||||
validator: RegularExpressionValidator { regularExpression: /^#([a-fA-F0-9]{0,6})$/ }
|
||||
validator: Cura.HexColorValidator {}
|
||||
}
|
||||
|
||||
Rectangle
|
||||
|
15
resources/qml/Validators/DoubleValidator.qml
Normal file
15
resources/qml/Validators/DoubleValidator.qml
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright (c) 2022 UltiMaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
import QtQuick 2.15
|
||||
|
||||
RegularExpressionValidator
|
||||
{
|
||||
property int maxBeforeDecimal: 10
|
||||
property int maxAfterDecimal: 10
|
||||
|
||||
regularExpression:
|
||||
{
|
||||
// The build in DoubleValidator doesn't handle "," and "." interchangably.
|
||||
return "^-?[0-9]{0," + maxBeforeDecimal + "}[.,]?[0-9]{0," + maxAfterDecimal + "}$"
|
||||
}
|
||||
}
|
8
resources/qml/Validators/HexColorValidator.qml
Normal file
8
resources/qml/Validators/HexColorValidator.qml
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2022 UltiMaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
import QtQuick 2.15
|
||||
|
||||
RegularExpressionValidator
|
||||
{
|
||||
regularExpression: /^#([a-fA-F0-9]{0,6})$/
|
||||
}
|
@ -19,6 +19,9 @@ SettingView 1.0 SettingView.qml
|
||||
ProfileMenu 1.0 ProfileMenu.qml
|
||||
PrintSelectorCard 1.0 PrintSelectorCard.qml
|
||||
|
||||
# Cura/Validators
|
||||
DoubleValidator 1.7 DoubleValidator.qml
|
||||
HexColorValidator 1.7 HexColorValidator.qml
|
||||
|
||||
# Cura/WelcomePages
|
||||
|
||||
@ -42,6 +45,7 @@ SingleSettingExtruderSelectorBar 1.7 SingleSettingExtruderSelectorBar.qml
|
||||
ExtruderButton 1.7 ExtruderButton.qml
|
||||
SingleSettingComboBox 1.7 SingleSettingComboBox.qml
|
||||
SingleSettingSlider 1.7 SingleSettingSlider.qml
|
||||
SingleSettingTextFieldWithUnit 1.7 SingleSettingTextFieldWithUnit.qml
|
||||
|
||||
|
||||
# Cura/MachineSettings
|
||||
|
Loading…
x
Reference in New Issue
Block a user