Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Update QTableView when my datasource gets a new record from remote server.
Qt 6.11 is out! See what's new in the release blog

Update QTableView when my datasource gets a new record from remote server.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 578 Views
  • 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.
  • R Offline
    R Offline
    ryman
    wrote on last edited by
    #1

    I implement a QAbstructTableModel, and I want insert a new row at the top of tableview when my datasource gets a new record from remote server. How to do this?

    JonBJ 1 Reply Last reply
    0
    • R ryman

      I implement a QAbstructTableModel, and I want insert a new row at the top of tableview when my datasource gets a new record from remote server. How to do this?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @ryman said in Update QTableView when my datasource gets a new record from remote server.:

      when my datasource gets a new record from remote server

      What do you mean by this? Do you mean something outside of your program causes the remote data source to now have an extra row? In which case, how does the remote know that has happened, and how would it inform your program that it had happened?

      1 Reply Last reply
      3
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        From https://doc.qt.io/qt-5/qabstractitemmodel.html#subclassing

        implementation must call beginInsertRows() before inserting new rows into the data structure, and endInsertRows() immediately afterwards.

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        3

        • Login

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