QTableView && QSqlQueryModel && data update

  • Hi all,

    I have a QTableView and its model QSqlQueryModel to show some data from a query.

    If I update the query, the tableView automatically scroll to the first row but I need to keep the old position of the table.

    Now I'm trying to register the actual scroll position of a table and to scroll to this position after an update but it doesn't works as good as expected.

    Is there a better solution?


  • I finally found a solution that works fine for me:

    int last_position = tableView->verticalScrollBar()->value();
    ... some update...

  • I know this is old, but I tried a lot of things to solve this same problem without success. Your solution worked for me. Thanks!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.