summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/util/qvalidator.cpp3
-rw-r--r--tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp9
2 files changed, 11 insertions, 1 deletions
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index fa3493b59a..37997c0359 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -415,8 +415,9 @@ QValidator::State QIntValidator::validate(QString & input, int&) const
qlonglong entered = QLocalePrivate::bytearrayToLongLong(buff.constData(), 10, &ok, &overflow);
if (overflow || !ok)
return Invalid;
+
if (entered >= b && entered <= t) {
- locale().toInt(input, &ok);
+ locale().toInt(input, &ok, 10);
return ok ? Acceptable : Intermediate;
}
diff --git a/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp b/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
index 369e3254e8..b7f4bd0061 100644
--- a/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
+++ b/tests/auto/widgets/widgets/qintvalidator/tst_qintvalidator.cpp
@@ -169,6 +169,15 @@ void tst_QIntValidator::validate_data()
QTest::newRow("8.9") << -1 << 100 << QString("5") << ACC;
QTest::newRow("8.10") << -1 << 100 << QString("+") << INT;
QTest::newRow("8.11") << -1 << 100 << QString("+50") << ACC;
+
+ QTest::newRow("9.0") << -10 << 10 << QString("000") << ACC;
+ QTest::newRow("9.1") << -10 << 10 << QString("008") << ACC;
+ QTest::newRow("9.2") << -10 << 10 << QString("-008") << ACC;
+ QTest::newRow("9.3") << -10 << 10 << QString("00010") << ACC;
+ QTest::newRow("9.4") << -10 << 10 << QString("-00010") << ACC;
+ QTest::newRow("9.5") << -10 << 10 << QString("00020") << INV;
+ QTest::newRow("9.6") << -10 << 10 << QString("-00020") << INV;
+
}
void tst_QIntValidator::validateArabic()