26bebd2037
For SingleSelection, removing the selected item will select the nearest item and, if autoScroll is enabled, ensures that the newly selected item is visible in the viewport. This may result in scrolling. For Multi- or ExtendedSelection, this should not happen, as having no selection is perfectly fine in those modes. However, QListView still tried to scroll to the current item in response to the currentIndexChanged signal. Since the currentIndex is at this point already hidden, the rectangle for it became invalid, and the attempt to scroll resulted in a one-pixel up-movement of the viewport (since the invalid rectangle has width == height == -1). Fix this by not scrolling if the rect for the index is invalid. Note that the index is still valid at this point, so we can't shortcut the call stack earlier. Add test that exercises the different combinations of ViewMode and SelectionMode, and demonstrates the one-pixel movement without the fix. Fixes: QTBUG-94788 Pick-to: 6.2 6.1 5.15 Change-Id: I1f36973eadb46e8c9b8b8068bc76ee09e9f490dd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> |
||
---|---|---|
.. | ||
qabstractitemview | ||
qcolumnview | ||
qdatawidgetmapper | ||
qfileiconprovider | ||
qheaderview | ||
qitemdelegate | ||
qitemeditorfactory | ||
qitemview | ||
qlistview | ||
qlistwidget | ||
qtableview | ||
qtablewidget | ||
qtreeview | ||
qtreewidget | ||
qtreewidgetitemiterator | ||
CMakeLists.txt |