Results 1 to 4 of 4

Thread: Asynchronous database operations

  1. #1

    Default Asynchronous database operations

    What is a proper way to operate on QSqlDatabase asynchronously?

    I know method with Worker class and QObject::moveToThread function, but in case when I work with QSqlTableModel i think it could be hard to use.

    How can I insert/update/remove from QSqlTableModel asynchronously? Is there any signals when data transfer (model->database and database->model) which I can use to inform user that operation is in progress (e.g. open progress dialog when start executing and close on complete, use message box if error).

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Asynchronous database operations

    If you need threaded access to a database while at the same time having a model, then you will need your own table model that does the threaded database access internally.

    Cheers,
    _

  3. #3

    Default Re: Asynchronous database operations

    Quote Originally Posted by anda_skoa View Post
    If you need threaded access to a database while at the same time having a model, then you will need your own table model that does the threaded database access internally.
    How can I achieve it? Which methods of QSqlTableModel should I overload?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Asynchronous database operations

    You would start with subclassing QAbstractTableModel and implementing columnCount(), rowCount() and data().

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 27th March 2013, 05:21
  2. asynchronous thread.
    By wookoon in forum Newbie
    Replies: 1
    Last Post: 7th July 2010, 08:16
  3. Article about asynchronous operations
    By skrzypu in forum Qt Programming
    Replies: 0
    Last Post: 10th March 2010, 12:43
  4. asynchronous vs. synchroneous
    By timmu in forum Qt Programming
    Replies: 4
    Last Post: 28th August 2009, 11:48
  5. How to manage QSqlTableModel database operations?
    By Abk in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2007, 11:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.