Doc fix in QIntValidator::validate() and comment on a test
The doc said positive values for a negative range were intermediate but the code actually rejects them if the value has an overt plus sign, so make clear that intermediate is only for the case without a sign. Incidentally comment on a test where it might not have been obvious to the reader that a space is the locale's digit-grouping chracter. Pick-to: 6.5 6.5.0 Change-Id: I3edab74fe8c2cbe8448c0e523676f1fd0d0d8a9f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
6f9ace5685
commit
58f5ec35f1
@ -331,12 +331,12 @@ QIntValidator::~QIntValidator()
|
||||
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
|
||||
hand, if the range consists of negative integers (e.g., -100 to -32) and
|
||||
\a input is a positive integer, then Intermediate is returned, because
|
||||
the user might be just about to type the minus (especially for right-to-left
|
||||
languages).
|
||||
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
|
||||
hand, if the range consists of negative integers (e.g., -100 to -32) and \a
|
||||
input is a positive integer without leading plus sign, then Intermediate is
|
||||
returned, because 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
|
||||
|
@ -165,6 +165,7 @@ void tst_QIntValidator::validateFrench()
|
||||
QIntValidator validator(-2000, 2000, 0);
|
||||
validator.setLocale(QLocale::French);
|
||||
int i;
|
||||
// Grouping separator is a narrow no-break space; QLocale accepts a space as it.
|
||||
QString s = QLatin1String("1 ");
|
||||
QCOMPARE(validator.validate(s, i), QValidator::Acceptable);
|
||||
validator.fixup(s);
|
||||
|
Loading…
Reference in New Issue
Block a user