Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. Doing the SQL task in another thread

Doing the SQL task in another thread

Scheduled Pinned Locked Moved Brainstorm
1 Posts 1 Posters 853 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.
  • batman.890825B Offline
    batman.890825B Offline
    batman.890825
    wrote on last edited by
    #1

    I have read similar issues with this topic, but the solutions people post to deal with it don't make use of neither the SQL high-level interface provided by Qt (QSqlTableModel and such) nor the Model/View programming.
    Since this two combined offer a very fast way to implement an app, it's easy to just use this approach rather than doing my own interface from "scratch".
    So I came up with this idea to keep using this two features and to make them suitable for multithreading programming. I will create my own QSqlTableModel & QSqlRelationalTableModel and re-implement those method needed for Model/View programming to work. The re-implemented methods will only call QMetaObject::​invokeMethod() with Qt::AutoConnection. This way I can have the models and the QSqlDatabase instance in one thread and the view with the rest of the GUI in another one.
    My questions are:

    • Is there a better solution?
    • Is my solution viable?
    • Which problem may I encounter with this approach?

    I do appreciate any feedback.

    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