TableView in QML jump scroll to top every time when QSqlQueryModel updated (setQuery)
Unsolved
QML and Qt Quick
-
I have created an example where the
TableView
is updated throughQSqlQueryModel
every 2 sec and each time scroll is jump top of window. How can I keep scrollbar position after the update model? -
Hi @uralbash,
Since
setQuery
resets the model the view and thus the scroll also resets.
You can use positionViewAtRow to scroll to a particular row. -
Thanks @p3c0,
I think that's pretty classic task, typically table does not change scrollbar position when data updated. Could you give an example of how I can do it. What events can I use for
positionViewAtRow
function and how I can know which row is equivalent of last position? As far as I rememberQTableView
doesn’t change scroll position.