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. QSqlQueryModel and TableView for dynamic data
Forum Update on Monday, May 27th 2025

QSqlQueryModel and TableView for dynamic data

Scheduled Pinned Locked Moved Solved QML and Qt Quick
24 Posts 4 Posters 6.4k 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.
  • X XDePedro
    6 Jun 2018, 09:07

    @JonB
    Database insertions/write are done in the working thread.
    Database queries/reads are done in the UI thread.

    J Offline
    J Offline
    JonB
    wrote on 6 Jun 2018, 09:22 last edited by
    #21

    @XDePedro
    So as far as I understand you must not do that, as per what I wrote above....

    X 1 Reply Last reply 6 Jun 2018, 09:42
    0
    • J JonB
      6 Jun 2018, 09:22

      @XDePedro
      So as far as I understand you must not do that, as per what I wrote above....

      X Offline
      X Offline
      XDePedro
      wrote on 6 Jun 2018, 09:42 last edited by
      #22

      @JonB
      Seems to work, but I will not do it this way...teh database here is just a fake database in order to be able to work in the model while the real db is yet not implemented.

      Thanks.

      Still wondering which model approach will feet better in what I ultimately have to implement. A lists of data that can have thousand of rows and can be updated by another thread (not user interaction). Any suggestions.

      J 1 Reply Last reply 6 Jun 2018, 09:47
      0
      • X XDePedro
        6 Jun 2018, 09:42

        @JonB
        Seems to work, but I will not do it this way...teh database here is just a fake database in order to be able to work in the model while the real db is yet not implemented.

        Thanks.

        Still wondering which model approach will feet better in what I ultimately have to implement. A lists of data that can have thousand of rows and can be updated by another thread (not user interaction). Any suggestions.

        J Offline
        J Offline
        JonB
        wrote on 6 Jun 2018, 09:47 last edited by JonB 6 Jun 2018, 09:51
        #23

        @XDePedro
        For the "updated by another thread (not user interaction)", my understanding is that you must not do that directly. If you need to, use signals & slots. You may get away without now, but supposedly not in the long run, under whatever circumstances.

        Read up on this, e.g. https://stackoverflow.com/questions/20793689/correctly-using-qsqldatabase-in-multi-threaded-programs, and many others.

        For the "model approach", I still think you need to answer my earlier question: do you fetch a brand new set of rows and those are the only ones to be shown in the table view, or do you "incrementally" fetch some additional new rows, and want those to be appended to what you already have in the model & the view?

        1 Reply Last reply
        0
        • X Offline
          X Offline
          XDePedro
          wrote on 6 Jun 2018, 12:24 last edited by
          #24

          Any help about which model should I use? Any help on how implement it?

          1 Reply Last reply
          0

          21/24

          6 Jun 2018, 09:22

          • Login

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