Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.6, 5.12.7
-
None
-
-
5c1bc5c8a41e9d4b40161eae1413bcb69325dd8f (qt/qtbase/5.15)
-
Q1/2020 Finale, Q2/2020 kick off
Description
QIntValidator and QLineEdit allow to enter positive value which is greater than specified maximum.
Example code (see also the attached file):
#include <QApplication> #include <QLineEdit> #include <QWidget> #include <QIntValidator> #include <QApplication> #include <QLineEdit> #include <QWidget> #include <QIntValidator> int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget w; w.resize(100, 100); int maxValue = 15; QIntValidator* iv = new QIntValidator(0, maxValue, &w); QLineEdit* lineEdit = new QLineEdit(&w); lineEdit->setGeometry(QRect(20, 40, 60, 20)); lineEdit->setValidator(iv); w.show(); return a.exec(); }
In this code the maximum is set to 15. In this case:
- Using Qt 5.12.6 or Qt 5.12.7 I can enter any two-digit number which is greater than 15 (for example 25 or 38). It is an unexpected behavior.
- Using Qt 5.9.9 I cannot enter a number greater than 15. It is an expected behavior.
Attachments
Issue Links
- resulted from
-
QTBUG-59650 QIntValidator::validate doesn't return Intermediate for value with number of digits equal to or less than the max value
- Closed