Important: Please read the Qt Code of Conduct -

GridView yPosition changes when sorting

  • I have a GridView (LtoR flow) that is sorted dynamically via a QSortFilterProxyModel. The GridView has 100 tiles at all times. I scroll down until visibleArea.yPosition is at e.g. 0.7 (70%). I wait for the model to update, causing the tiles to reorder. Since the nr of tiles doesn't change, I'd expect visibleArea.yPosition to stay at 0.7 - but it doesn't. It changes to other values (I can't really figure out a pattern). Likewise, originY changes.

    This means, for example, that if I scroll to the end of the grid and wait for a bit, I might actually be looking at the beginning of the grid after a while, due to these changes. I tried setting visibleArea.yPosition to the value it had at the end of the last user interaction whenever the data changes, but QML tells me that the property is read-only.

    Why does the scroll position of the GridView jump around like this, and how can I stop it?