Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
3.x
-
None
-
71e6e429ea6afc97dfa6bb5d158a751a4a092eea
Description
How to reproduce
==============
1. Derive from QStyledItemDelegate and reimplement displayText() to always display some constant string,
2. Take a table model,
3. Insert a column (which will cause the column to be filled with null values initially),
4. Plug the model into a view,
5. Set an instance of your custom QStyledItemDelegate as the delegate for the newly inserted column.
Expected result
============
The inserted column should show the constant string from your custom displayText() method
Actual result
==========
displayText() isn't called at all, probably because of the value.isNull() checks in initStyleOption (see http://qt.gitorious.org/qt/qt/blobs/master/src/gui/itemviews/qstyleditemdelegate.cpp#line381 for example).
Proposed fix
==========
Mention in the documentation for displayText() that it will be skipped if the QVariant for that model index isNull().
Known workaround
===============
Let your model return empty QStrings for the problematic indices (so that displayText gets called).