Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.3
-
None
Description
QValidator has a changed() signal to notify that its inputs have changed, implying that the validity of the text may have changed.
However, this signal is not used by QLineEdit (QWidgetLineControl).
auto validator = new QIntValidator(); validator->setRange(0, 9); lineEdit->setValidator(validator); lineEdit->setText("99"); // "99" is invalid, but setText() ignores the validator validator->setRange(10, 99); // From here, the text "99" is valid: QLineEdit::hasAcceptableInput() returns true // However, the QLineEdit has not received the changed() signal and QWidgetLineControl::m_validInput is still false // This situation allows user to type anything e.g. a letter, meaning that we could end up having "99a" as text.