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. QSqlTableModel ... is possible update data without QAbstractmodel?
Forum Updated to NodeBB v4.3 + New Features

QSqlTableModel ... is possible update data without QAbstractmodel?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.2k Views 1 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.
  • gfxxG Offline
    gfxxG Offline
    gfxx
    wrote on last edited by gfxx
    #1

    I use QSqlTableModel for show in gui a sqlite table of data. The data lines are continually added according to a ramdon pattern but about every 2-3 minutes. However, updates may take up to 0.5 to 2 seconds. So when the user looks at the QTableView, the data is added to the database, but the user does not see the change. Can SqlTableView update data in "real time" and wihout using QAbstractModel mechanism? I have a lot of tableview, and many different so the make very long my code.

    these project run over ubuntu 14.04 64bit sqlite3 and qt5.6 c++.

    regards
    giorgio

    bkt

    raven-worxR 2 Replies Last reply
    0
    • gfxxG gfxx

      I use QSqlTableModel for show in gui a sqlite table of data. The data lines are continually added according to a ramdon pattern but about every 2-3 minutes. However, updates may take up to 0.5 to 2 seconds. So when the user looks at the QTableView, the data is added to the database, but the user does not see the change. Can SqlTableView update data in "real time" and wihout using QAbstractModel mechanism? I have a lot of tableview, and many different so the make very long my code.

      these project run over ubuntu 14.04 64bit sqlite3 and qt5.6 c++.

      regards
      giorgio

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @gfxx
      what is a QSqlTableView?! At least not a class that is shipped within Qt packages.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      gfxxG 1 Reply Last reply
      2
      • raven-worxR raven-worx

        @gfxx
        what is a QSqlTableView?! At least not a class that is shipped within Qt packages.

        gfxxG Offline
        gfxxG Offline
        gfxx
        wrote on last edited by
        #3

        @raven-worx real sorry .... I correct the post.

        bkt

        1 Reply Last reply
        0
        • gfxxG gfxx

          I use QSqlTableModel for show in gui a sqlite table of data. The data lines are continually added according to a ramdon pattern but about every 2-3 minutes. However, updates may take up to 0.5 to 2 seconds. So when the user looks at the QTableView, the data is added to the database, but the user does not see the change. Can SqlTableView update data in "real time" and wihout using QAbstractModel mechanism? I have a lot of tableview, and many different so the make very long my code.

          these project run over ubuntu 14.04 64bit sqlite3 and qt5.6 c++.

          regards
          giorgio

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @gfxx said in QSqlTableModel ... is possible update data without QAbstractmodel?:

          Can SqlTableView update data in "real time" and wihout using QAbstractModel mechanism?

          since the Qt item views are all based upon a common data source interface (QAbstractItemModel) ... no.

          So my advice:

          1. implement a common QAbstractItemModel class
          2. fetch the SQL data in the background
          3. update the cached data in your custom model implementation with the result from the query

          Share the model across views as much as possible.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          gfxxG 1 Reply Last reply
          0
          • raven-worxR raven-worx

            @gfxx said in QSqlTableModel ... is possible update data without QAbstractmodel?:

            Can SqlTableView update data in "real time" and wihout using QAbstractModel mechanism?

            since the Qt item views are all based upon a common data source interface (QAbstractItemModel) ... no.

            So my advice:

            1. implement a common QAbstractItemModel class
            2. fetch the SQL data in the background
            3. update the cached data in your custom model implementation with the result from the query

            Share the model across views as much as possible.

            gfxxG Offline
            gfxxG Offline
            gfxx
            wrote on last edited by
            #5

            @raven-worx I was hoping for some shortcuts .... but thanks the same

            regards
            giorgio

            bkt

            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