Priority: P2: Important
Affects Version/s: 5.15.2, 6.1.3
Fix Version/s: None
Component/s: Widgets: Itemviews
QTreeView::scrollTo uses the scroll bar's pageStep as count of how many items are visible in the viewport. It uses that and the index of the first visible item to check whether the item is already in view. The pageStep however is not dependent on the actually visible items in the view, but instead is calculated by taking as many items from the end of the model that would fit into the view.
The result is that if the end of the model has smaller items, pageStep is bigger than it should be, because more of the smaller items fit into view. Thus it thinks the target item fits, and does not scroll, even if the item is partially or completely out of view.
Here a reproducer, just press arrow down on the keyboard until the selected item is no longer visible:
A workaround is to use QAbstractItemView::ScrollPerPixel instead of QAbstractItemView::ScrollPerItem.
|For Gerrit Dashboard: QTBUG-96980|
|376569,4||Fix QTreeView::scrollTo not always scrolling when necessary||dev||qt/qtbase||Status: NEW||-1||0|