-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.5.2
-
None
-
f5f8a8c346b7566b544d500254c6f9f4eb109c79
QStyledItemDelegate is comitting data before QValidator::fixup() of
QLineEdit attached would be called so results of QValidator::fixup()
sometimes are ignored
There is attached project TestCase. Validator's fixup() should
augment hex values with leading zeros.
STEPS TO REPRODUCE / TEST CASE
1. Start executable TestCase.exe (built using of attached project)
2. Double click on some table cell
3. Enter single hex digit into the edit widget (you will see something
like SNAPSHOT-1.PNG attached)
4. Press ENTER key (you will see something like SNAPSHOT-2.PNG
attached). So far so good - fixup() of custom HexValidator is called
OK and the entered single digit would transform to a 8-digit value.
5. Repeat steps 2 and 3.
6. Instead of pressing ENTER, press Arrow Down key (you will see
something like SNAPSHOT-3.PNG attached). In other words the edited
value consists of single digit as before. This means that fixup()
function's result was ignored even if fixup() was called after
editing finished.
QT VERSIONS WHERE BUG MANIFESTS ITSELF:
TestCase demonstrates identical behaviour being compiled under
Qt 4.5.2 and being compiled under Qt 4.6.0-beta1.
WORKAROUND:
To workaround the bug one may reimplement
QStyledItemDelegate::setModelData() and manually call fixup() before
comitting the data (i.e. before model->setData() call).
One may define macro WORKAROUND within the file HexDelegate.h of TestCase
project attached and recompile the project to put the workaround
into operation.