Exemplo n.º 1
0
def add_validation(edit: QtWidgets.QLineEdit, validation: Callable[[], bool], post_validation: Callable[[], None]):
    def field_validation():
        common_qt_lib.set_error_border_stylesheet(edit, not validation())
        post_validation()

    common_qt_lib.set_error_border_stylesheet(edit, False)
    edit.field_validation = field_validation
    edit.textChanged.connect(field_validation)
Exemplo n.º 2
0
def update_validation(widget: QtWidgets.QLineEdit):
    if hasattr(widget, "field_validation"):
        widget.field_validation()