mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 13:47:51 -06:00
Add validators to project.
CURA-9793
This commit is contained in:
parent
522bf60e81
commit
487bf41a7b
4 changed files with 28 additions and 1 deletions
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})$/
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue