Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.1
-
7266e11297874736e54bc59fd3d4d827d03ce2e2
Description
When an inputMask is used with a QLineEdit, setSelection might fail.
See small sample application: the last character should be selected, but it is not.
The bug is easy to locate. In QLineEdit::setSelection, the code starts with:
if (start < 0 || start > (int)d->control->text().length())
{ qWarning("QLineEdit::setSelection: Invalid start position (%d)", start); return; }But it is wrong to use d->control->text() because this removes the blank characters when an input mask is used. This causes a wrong warning to be issue and a return.
The code should be in fact:
if (start < 0 || start >= (int)d->control->end()) {