diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-03-27 14:10:43 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-04-01 21:37:48 +0200 |
commit | 5c1bc5c8a41e9d4b40161eae1413bcb69325dd8f (patch) | |
tree | 8206164a54fd4acc3b87a227d5107e40ea1be12d /src/gui/util/qvalidator.cpp | |
parent | 7ed097b31f7e15812144c360021872cf8f11821e (diff) |
QLineEdit: clarify the impact of using validators
Values that are validated as Intermediate are possible to enter, but
returnPressed and editingFinished signals are not emitted.
Fixes: QTBUG-82915
Change-Id: I3e194cd6ee93b3402090117b67044cf3663a232e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/gui/util/qvalidator.cpp')
-rw-r--r-- | src/gui/util/qvalidator.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index 54cbb28ffa..6e87faf534 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -370,8 +370,9 @@ QIntValidator::~QIntValidator() \fn QValidator::State QIntValidator::validate(QString &input, int &pos) const Returns \l Acceptable if the \a input is an integer within the - valid range, \l Intermediate if the \a input is a prefix of an integer in the - valid range, and \l Invalid otherwise. + valid range. If \a input has at most as many digits as the top of the range, + or is a prefix of an integer in the valid range, returns \l Intermediate. + Otherwise, returns \l Invalid. If the valid range consists of just positive integers (e.g., 32 to 100) and \a input is a negative integer, then Invalid is returned. (On the other @@ -380,6 +381,10 @@ QIntValidator::~QIntValidator() the user might be just about to type the minus (especially for right-to-left languages). + Similarly, if the valid range is between 46 and 53, then 41 and 59 will be + evaluated as \l Intermediate, as otherwise the user wouldn't be able to + change a value from 49 to 51. + \snippet code/src_gui_util_qvalidator.cpp 2 By default, the \a pos parameter is not used by this validator. |