TableView in QML jump scroll to top every time when QSqlQueryModel updated (setQuery)
-
I have created an example where the
TableViewis updated throughQSqlQueryModelevery 2 sec and each time scroll is jump top of window. How can I keep scrollbar position after the update model? -
I have created an example where the
TableViewis updated throughQSqlQueryModelevery 2 sec and each time scroll is jump top of window. How can I keep scrollbar position after the update model?Hi @uralbash,
Since
setQueryresets the model the view and thus the scroll also resets.
You can use positionViewAtRow to scroll to a particular row. -
Hi @uralbash,
Since
setQueryresets 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
positionViewAtRowfunction and how I can know which row is equivalent of last position? As far as I rememberQTableViewdoesn’t change scroll position.