Skip to content

NotStrictValidator

Qt Base Class: QValidator

Signature: QValidator(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
Validator
prettyqt.gui.validator

⋔ Inheritance diagram

graph TD
  1473296398384["validators.NotStrictValidator"]
  1473245568976["gui.Validator"]
  1473245536768["gui.ValidatorMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473289208592["QtGui.QValidator"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473245568976 --> 1473296398384
  1473245536768 --> 1473245568976
  1473299815024 --> 1473245536768
  140713234304496 --> 1473299815024
  1473289208592 --> 1473245568976
  1473288842240 --> 1473289208592
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: Validator

Validator which turns Invalid state into Intermediate state.

Source code in prettyqt\validators\notstrictvalidator.py
class NotStrictValidator(gui.Validator):
    """Validator which turns Invalid state into Intermediate state."""

    ID = "not_strict"

    def __init__(self, validator: gui.QValidator | None = None, **kwargs):
        self._validator = validator
        super().__init__(**kwargs)

    def __eq__(self, other: object):
        return (
            isinstance(other, NotStrictValidator) and other._validator == self._validator
        )

    def validate(self, text: str, pos: int = 0) -> tuple[gui.QValidator.State, str, int]:
        state, text, pos = self._validator.validate(text, pos)
        is_invalid = state == self.State.Invalid
        return self.State.Intermediate if is_invalid else state, text, pos

⌗ Property table

Qt Property Type Doc
objectName QString

Validator ID: not_strict