![]() |
NDEVR
API Documentation
|
Responsible on most user input fields for correcting the input when possible or allerting the user that the input is incorrect. More...
Classes | |
| struct | InvalidProperties |
| Contains the result of a validation check, including the validity state, a suggested fix-up message, and an optional character range. More... | |
Public Types | |
| enum | ValidityMessage { e_is_valid , e_unexpected_format , e_value_is_not_a_real_number , e_too_many_decimals , e_value_too_high , e_value_too_low , e_value_is_empty , e_string_is_too_long , e_string_is_too_short , e_file_exists } |
| Describes the type of validation failure encountered during input checking. More... | |
Public Member Functions | |
| QCustomValidator (const QCustomValidator &validator) | |
| Copy constructor. | |
| QCustomValidator (const TypeInfo &info, QObject *parent=nullptr) | |
| Constructs a validator configured for the specified type info. | |
| QCustomValidator (QObject *parent=nullptr) | |
| Constructs a validator with default settings. | |
| void | clearNumberOfDecimals () |
| Clears the decimal place limit, allowing any number of decimals. | |
| void | fixup (QString &input) const override |
| Fixes up a Qt string input by correcting or clamping invalid values. | |
| void | fixup (StringAllocatingView &input) const |
| Fixes up an NDEVR string input by correcting or clamping invalid values. | |
| void | fixup (StringAllocatingView &input, bool to_unit, bool from_unit=true) const |
| Fixes up an NDEVR string input with optional unit conversion. | |
| fltp08 | getMax () const |
| Returns the maximum allowed numeric value. | |
| TranslatedString | getMessageString (ValidityMessage message) |
| Returns a user-facing translated message for the given validity state. | |
| fltp08 | getMin () const |
| Returns the minimum allowed numeric value. | |
| InvalidProperties | getValidity (const StringView &input) const |
| Returns detailed validity information for the given input string. | |
| fltp08 | max () const |
| Returns the maximum allowed numeric value. | |
| fltp08 | min () const |
| Returns the minimum allowed numeric value. | |
| const QCustomValidator & | operator= (const QCustomValidator &other) |
| Assignment operator. | |
| const String & | regex () const |
| Returns the regular expression pattern for validation. | |
| void | setAllowEmpty (bool allow_empty) |
| Sets whether an empty input is considered valid. | |
| void | setAllowNewline (bool allow_newline) |
| Sets whether newline characters are allowed in the input. | |
| void | setAllowWrapping (bool allow_wrapping) |
| Sets whether values are allowed to wrap from max to min and vice versa. | |
| void | setCustomCallback (const std::function< ValidityMessage(const StringView &)> &callback) |
| Sets a custom validation callback that returns a ValidityMessage for the input. | |
| template<class t_angle_type> | |
| void | setMax (Angle< t_angle_type > max) |
| Sets the maximum allowed value from an angle type, converting to internal units. | |
| void | setMax (fltp08 max) |
| Sets the maximum allowed numeric value. | |
| template<class t_angle_type> | |
| void | setMin (Angle< t_angle_type > min) |
| Sets the minimum allowed value from an angle type, converting to internal units. | |
| void | setMin (fltp08 min) |
| Sets the minimum allowed numeric value. | |
| void | setNumberOfDecimals (uint04 decimals) |
| Sets the maximum number of allowed decimal places. | |
| void | setRegex (const StringView ®ex) |
| Sets a regular expression pattern that the input must match. | |
| void | setStep (fltp08 step) |
| Sets the step increment used for value adjustment (e.g., spin box arrows). | |
| void | setTypeInfo (const TypeInfo &info) |
| Sets the type information used to configure validation rules. | |
| void | setUnitType (UnitCategory type) |
| Sets the unit category type used for unit validation. | |
| void | setUnitValidator (const ConstPointer< Unit > &unit, uint01 dimension=Constant< uint01 >::Invalid) |
| Sets the unit used for converting between display and internal values. | |
| fltp08 | step () const |
| Returns the step increment value. | |
| const TypeInfo & | typeInfo () const |
| Returns the type information used by this validator. | |
| const ConstPointer< Unit > & | unit () const |
| Returns the unit used for validation and conversion. | |
| uint01 | unitDimension () const |
| Returns the unit dimension index used for multi-dimensional unit conversions. | |
| const UnitCategory & | unitType () const |
| Returns the unit category type. | |
| QValidator::State | validate (QString &input, int &pos) const override |
| Validates a Qt string input and returns the validation state. | |
Responsible on most user input fields for correcting the input when possible or allerting the user that the input is incorrect.
Used on all QCustomLineEdit widgets and derivatives.
Definition at line 48 of file QCustomValidator.h.
Describes the type of validation failure encountered during input checking.
Definition at line 55 of file QCustomValidator.h.
|
explicit |
Constructs a validator with default settings.
| [in] | parent | The parent QObject, or nullptr. |
Referenced by QCustomValidator(), and operator=().
|
explicit |
Constructs a validator configured for the specified type info.
| [in] | info | The type information used to configure validation rules. |
| [in] | parent | The parent QObject, or nullptr. |
| QCustomValidator::QCustomValidator | ( | const QCustomValidator & | validator | ) |
Copy constructor.
| [in] | validator | The validator to copy from. |
References QCustomValidator().
|
override |
Fixes up a Qt string input by correcting or clamping invalid values.
| [in] | input | The string to fix up, modified in place. |
| void QCustomValidator::fixup | ( | StringAllocatingView & | input | ) | const |
Fixes up an NDEVR string input by correcting or clamping invalid values.
| [in] | input | The string to fix up, modified in place. |
| void QCustomValidator::fixup | ( | StringAllocatingView & | input, |
| bool | to_unit, | ||
| bool | from_unit = true ) const |
Fixes up an NDEVR string input with optional unit conversion.
| [in] | input | The string to fix up, modified in place. |
| [in] | to_unit | Whether to convert the result to the display unit. |
| [in] | from_unit | Whether to convert the input from the display unit first. |
|
inline |
Returns the maximum allowed numeric value.
Definition at line 189 of file QCustomValidator.h.
| TranslatedString QCustomValidator::getMessageString | ( | ValidityMessage | message | ) |
Returns a user-facing translated message for the given validity state.
| [in] | message | The validity message to translate. |
|
inline |
Returns the minimum allowed numeric value.
Definition at line 194 of file QCustomValidator.h.
| InvalidProperties QCustomValidator::getValidity | ( | const StringView & | input | ) | const |
Returns detailed validity information for the given input string.
| [in] | input | The string to check. |
|
inlinenodiscard |
Returns the maximum allowed numeric value.
Definition at line 211 of file QCustomValidator.h.
|
inlinenodiscard |
Returns the minimum allowed numeric value.
Definition at line 216 of file QCustomValidator.h.
| const QCustomValidator & QCustomValidator::operator= | ( | const QCustomValidator & | other | ) |
Assignment operator.
| [in] | other | The validator to copy from. |
References QCustomValidator().
|
inlinenodiscard |
Returns the regular expression pattern for validation.
Definition at line 236 of file QCustomValidator.h.
Referenced by setRegex().
|
inline |
Sets whether an empty input is considered valid.
| [in] | allow_empty | True to allow empty input, false to require a value. |
Definition at line 169 of file QCustomValidator.h.
|
inline |
Sets whether newline characters are allowed in the input.
| [in] | allow_newline | True to allow newlines, false to reject them. |
Definition at line 174 of file QCustomValidator.h.
|
inline |
Sets whether values are allowed to wrap from max to min and vice versa.
| [in] | allow_wrapping | True to allow wrapping, false to clamp. |
Definition at line 164 of file QCustomValidator.h.
|
inline |
Sets a custom validation callback that returns a ValidityMessage for the input.
| [in] | callback | The custom validation function. |
Definition at line 159 of file QCustomValidator.h.
|
inline |
Sets the maximum allowed value from an angle type, converting to internal units.
| [in] | max | The maximum angle value. |
Definition at line 200 of file QCustomValidator.h.
References max().
|
inline |
Sets the maximum allowed numeric value.
| [in] | max | The maximum value. |
Definition at line 179 of file QCustomValidator.h.
References max().
|
inline |
Sets the minimum allowed value from an angle type, converting to internal units.
| [in] | min | The minimum angle value. |
Definition at line 206 of file QCustomValidator.h.
References min().
|
inline |
Sets the minimum allowed numeric value.
| [in] | min | The minimum value. |
Definition at line 184 of file QCustomValidator.h.
References min().
|
inline |
Sets the maximum number of allowed decimal places.
| [in] | decimals | The number of decimal places allowed. |
Definition at line 144 of file QCustomValidator.h.
| void QCustomValidator::setRegex | ( | const StringView & | regex | ) |
Sets a regular expression pattern that the input must match.
| [in] | regex | The regex pattern string. |
References regex().
Referenced by DesignObjectComboWidget::setNDPO().
|
inline |
Sets the step increment used for value adjustment (e.g., spin box arrows).
| [in] | step | The step increment value. |
Definition at line 221 of file QCustomValidator.h.
References step().
|
inline |
Sets the type information used to configure validation rules.
| [in] | info | The type information. |
Definition at line 262 of file QCustomValidator.h.
| void QCustomValidator::setUnitType | ( | UnitCategory | type | ) |
Sets the unit category type used for unit validation.
| [in] | type | The unit category. |
| void QCustomValidator::setUnitValidator | ( | const ConstPointer< Unit > & | unit, |
| uint01 | dimension = Constant< uint01 >::Invalid ) |
|
nodiscard |
|
inlinenodiscard |
Returns the type information used by this validator.
Definition at line 267 of file QCustomValidator.h.
|
inlinenodiscard |
Returns the unit used for validation and conversion.
Definition at line 252 of file QCustomValidator.h.
Referenced by setUnitValidator().
|
inlinenodiscard |
Returns the unit dimension index used for multi-dimensional unit conversions.
Definition at line 272 of file QCustomValidator.h.
|
inlinenodiscard |
Returns the unit category type.
Definition at line 257 of file QCustomValidator.h.
|
override |
Validates a Qt string input and returns the validation state.
| [in] | input | The string to validate. |
| [in] | pos | The cursor position, updated if the input is modified. |