Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Efficiently remove row from QML TableView attached to QSqlTableModel
Forum Updated to NodeBB v4.3 + New Features

Efficiently remove row from QML TableView attached to QSqlTableModel

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 644 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oMittens
    wrote on last edited by
    #1

    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 TableView if the view retained the correct mapping of indices. Does anyone have a solution for this? We have been tearing our hair out for weeks.

    Thanks,
    oMittens

    1 Reply Last reply
    1
    • O Offline
      O Offline
      oMittens
      wrote on last edited by
      #2

      For anyone still having this problem the solution was to use a QSortFilterProxyModel in front of the QSqlTableModel and filter the deleted rows.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved