Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.4.0
-
None
-
Qt 5.4.0, GCC 4.9.2 (built by the MinGW-x64 project), Windows 8.1 x64
Description
When overriding QAbstractItemDelegate, and overriding the
void TileToolDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const function,
and using this delegate on a QListView (QListView::setItemDelegate()),
the 'option' parameter's 'viewItemPosition' is always 'Invalid' (QStyleOptionViewItem::ViewItemPosition::Invalid).
This is an easy fix. QListView is supposed to set 'viewItemPosition' to 'End','Beginning', 'Middle', or 'OnlyOne', (depending on the positioning of the item to be drawn - which is easily determined from the QModelIndex) before calling the itemDelegate's 'paint()' function.
I'm not sure what other item views fail to set it, if any.