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

Itemview mouse and key press event handlers set selections differently

    XMLWordPrintable

Details

    Description

      QAbstractItemView::keyPressEvent() only calls setSelection() if the selection flags contain Current, while QAbstractItemView::mousePressEvent() calls setSelection() regardless of the selection flags.

      This leads to inconsistent behavior when calling setCurrentItem(<someItem>) in a slot connected to currentItemChanged(), for example. When navigating with the arrow keys, calling setCurrentItem() works as expected, while when clicking on an item with the mouse, this is overridden by the mousePressEvent()'s call to setSelection().

      Attachments

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

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes