48 QWidget* parent =
nullptr,
97 std::function<bool(QString)>
validator_ = [](QString s) {
return true; };
bool showsStatusTooltip() const
Returns whether or not the tooltip is used to show a reason for input rejection.
Definition validatinglineedit.cpp:71
ValidationMode validation_mode_
Determines how the input text is validated, see ValidationMode modes.
Definition validatinglineedit.h:93
void updateValidation()
Updates the visual indicator using the current text.
Definition validatinglineedit.cpp:55
void setValidationMode(ValidationMode mode)
Changes the validation mode to the new mode.
Definition validatinglineedit.cpp:44
bool acceptsEmptyPaths() const
Returns whether or not an empty path will be accepted.
Definition validatinglineedit.cpp:60
bool hasValidText()
Checks if the current text is valid.
Definition validatinglineedit.cpp:23
void setCustomValidator(std::function< bool(QString)> validator)
Sets a new custom validator function. Does not affect validation mode.
Definition validatinglineedit.cpp:50
ValidationMode
Type of validation to be applied.
Definition validatinglineedit.h:20
@ VALID_PATH_EXISTS
Requires text to be a path to an existing file or directory.
Definition validatinglineedit.h:26
@ VALID_NOT_EMPTY
Requires text to not be an empty string.
Definition validatinglineedit.h:24
@ VALID_IS_EXISTING_DIRECTORY
Requires text to be a path to an existing directory.
Definition validatinglineedit.h:32
@ VALID_IS_EXISTING_FILE
Requires text to be a path to an existing file.
Definition validatinglineedit.h:30
@ VALID_NONE
All text is valid.
Definition validatinglineedit.h:22
@ VALID_CUSTOM
Uses a custom validation function.
Definition validatinglineedit.h:28
void onTextChanged(const QString &new_text)
Connected to this line edits textChanged signal. Updates the visual indicator.
Definition validatinglineedit.cpp:81
void setAcceptsEmptyPaths(bool accept)
Sets whether or not an empty path will be accepted.
Definition validatinglineedit.cpp:65
bool show_status_tooltip_
If true: Use the tooltip to display a reason for input rejection.
Definition validatinglineedit.h:101
std::function< bool(QString)> validator_
If the validation mode is set to VALID_CUSTOM, this function will be called and be passed the current...
Definition validatinglineedit.h:97
ValidatingLineEdit(QWidget *parent=nullptr, ValidationMode mode=VALID_NOT_EMPTY)
Calls QLineEdit constructor and sets the validation mode.
Definition validatinglineedit.cpp:7
void setShowStatusTooltip(bool show)
Sets whether or not the tooltip is used to show a reason for input rejection.
Definition validatinglineedit.cpp:76
bool accept_empty_paths_
If true: Empty paths will be accepted in VALID_PATH_EXISTS.
Definition validatinglineedit.h:99