![]() |
HAL
|
Base class for any string validator. More...
#include <validator.h>
Public Member Functions | |
virtual bool | validate (const QString &input)=0 |
void | setFailText (const QString &text) |
QString | failText () const |
Protected Attributes | |
QString | mFailText = "Chosen input is not allowed." |
Base class for any string validator.
A Validator can be used to check if a string meets certain requirements. It is intended to be used in and input dialog to dynamically validate the input string of the user. If the input is not considered valid and the validation fails the Validator provides a 'fail text' that can be inserted in the input dialog widget to provide further information about the reason why the validation failed.
Definition at line 40 of file validator.h.
QString hal::Validator::failText | ( | ) | const |
Accesses the fail text configured via Validator::setFailText (or a default fail text if no text was configured).
Definition at line 10 of file validator.cpp.
References mFailText.
void hal::Validator::setFailText | ( | const QString & | text | ) |
Configures the fail text that describes the reason for a failed validation. It can be accessed via Validator::failText.
text | - The new fail text |
Definition at line 5 of file validator.cpp.
References mFailText.
Referenced by hal::EmptyStringValidator::EmptyStringValidator(), hal::HexadecimalValidator::HexadecimalValidator(), hal::UniqueStringValidator::UniqueStringValidator(), and hal::StackedValidator::validate().
|
pure virtual |
Given any input string this function returns true if the Validator considers this string as valid. It returns false otherwise.
input | - The input string |
Implemented in hal::UniqueStringValidator, hal::StackedValidator, hal::HexadecimalValidator, hal::EmptyStringValidator, and hal::GroupingTableModel.
|
protected |
Definition at line 69 of file validator.h.
Referenced by failText(), and setFailText().