Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47755

viewItemPosition not set in QListView when passed to QAbstractItemDelegate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.4.0
    • Widgets: Itemviews
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            Jamin Grey Jamin Grey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes