Efficiently remove row from QML TableView attached to QSqlTableModel
Hello QT world,
My team and I have been struggling to remove a row from our
QSqlTableModel. I know that to refresh the model,
select()must be called. However, this is not an option for us, because it is slow (even with an in-memory database) and it loses the user's scroll position. We manually handle deletion from the database (with an ORM we are using), so we really just want to remove the row from the model cache. It would also be acceptable to hide the row in the
TableViewif the view retained the correct mapping of indices. Does anyone have a solution for this? We have been tearing our hair out for weeks.
For anyone still having this problem the solution was to use a
QSortFilterProxyModelin front of the
QSqlTableModeland filter the deleted rows.