validators
Docs
PrettyQt Validators
PrettyQt ships a large number of predefined validators.
Apart from LineEdits, ComboBoxes and SpinBoxes, PlainTextEdits also gained the ability to take a validator.
The set_validator method also gained a "strict" keyword argument, which wraps the passed validator into a NotStrictValidator, effectively removing the "Invalid" state. That way there never is a situation where the user input is ignored, which might be preferred in a lot of situations.
The acceptance of "" may also be overriden explicitely by setting the "allow_empty" keyword argument.
Validators can also be combined. The resulting CompositeValidator checks if all containing validators accept the input.
Example:
val_1 = BlackListValidator(["Blacklisted word"])
val_2 = AlphanumericValidator()
and_validator = val_1 & val_2 # returns an AndValidator
val_1 = AlphanumericValidator()
val_2 = RegularExpressionValidator("some_regex")
or_val = val_1 | val_2 # returns an OrValidator
Classes
Name | Children | Inherits |
---|---|---|
NotStrictValidator prettyqt.validators.notstrictvalidator |
||
BlacklistValidator prettyqt.validators.blacklistvalidator |
||
FloatListValidator prettyqt.validators.regexvalidators |
|
|
IntegerValidator prettyqt.validators.integervalidator |
||
TextLengthValidator prettyqt.validators.textlengthvalidator |
||
JsonValidator prettyqt.validators.jsonvalidator |
||
NotEmptyValidator prettyqt.validators.blacklistvalidator |
||
EmptyValidator prettyqt.validators.whitelistvalidator |
||
PythonCodeValidator prettyqt.validators.pythoncodevalidator |
||
WhitelistValidator prettyqt.validators.whitelistvalidator |
||
HexValidator prettyqt.validators.hexvalidator |
||
RegexPatternValidator prettyqt.validators.regexpatternvalidator |
||
ColorValidator prettyqt.validators.colorvalidator |
||
MonotonicListValidator prettyqt.validators.monotoniclistvalidator |
||
QssValidator prettyqt.validators.qssvalidator |
||
IntListValidator prettyqt.validators.regexvalidators |
|
|
FunctionValidator prettyqt.validators.functionvalidator |
||
OrValidator prettyqt.validators.compositevalidator |
|
|
NotZeroValidator prettyqt.validators.blacklistvalidator |
||
ScientificFloatValidator prettyqt.validators.scientificvalidators |
|
|
PathValidator prettyqt.validators.pathvalidator |
||
ScientificIntegerValidator prettyqt.validators.scientificvalidators |
|
|
AndValidator prettyqt.validators.compositevalidator |
|
|
AlphaNumericValidator prettyqt.validators.alphanumericvalidator |