nqrduck.helpers.validators#
Helper used for validating input.
Classes
|
A validator for floats. |
|
A validator for integers. |
- class nqrduck.helpers.validators.DuckFloatValidator(*args: Any, **kwargs: Any)#
A validator for floats. Accepts only floats.
This is used to validate the input of the QLineEdit widgets. It also replaces commas with dots.
- Parameters:
parent (QObject) – The parent object
min_value (float) – The minimum value that is accepted
max_value (float) – The maximum value that is accepted
- fixup(value: str)#
Replaces commas with dots.
- Parameters:
value (str) – The input value
- Returns:
The fixed value
- Return type:
str
- validate(value: str, position: int)#
Validates the input value.
- Parameters:
value (str) – The input value
position (int) – The position of the cursor
- Returns:
The validation state, the fixed value, and the position
- Return type:
Tuple[QValidator.State, str, int]
- class nqrduck.helpers.validators.DuckIntValidator(*args: Any, **kwargs: Any)#
A validator for integers. Accepts only integers.
This is used to validate the input of the QLineEdit widgets.
- Parameters:
parent (QObject) – The parent object
min_value (int) – The minimum value that is accepted
max_value (int) – The maximum value that is accepted
- validate(value: str, position: int) tuple[PyQt6.QtGui.QValidator.State, str, int]#
Validates the input value.
- Parameters:
value (str) – The input value
position (int) – The position of the cursor
- Returns:
The validation state, the fixed value, and the position
- Return type:
Tuple[QValidator.State, str, int]