Results 1 to 4 of 4

Thread: What design for one SQLite table and multiple models ? Bug or design issue ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Sep 2008
    Posts
    60
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 10 Times in 9 Posts

    Default Re: What design for one SQLite table and multiple models ? Bug or design issue ?

    Hi Tapioca

    My application also works with a large DB and I did not even consider using QSqlTableModel. I inherit my models directly from QAbstractItemModel. The application allows opening multiple instances of various view types over the same instance of a model. And, at the same time, I use different types of models to represent the same data stored in the database. The models are optimized for performance and are specific to the tasks of my application.

    The models are connected and notify each other on data modifications. For example, when a user modifies data through a view, setData() is called on the target model. At this point the model notifies related models on what is about to happen and delegates the work to the database. When response arrives from the database, the model notifies its related models about the result of the operation and updates its internal data structures. The attached views pick up the changes. The notified models also update their internal data structures and their views also pick up the changes.

    This is a simplified description of what is really happening. But I cannot imagine doing things differently when an application has to deal with millions of database records and at the same time being fast and responsive.

    Just my 2 cents.

  2. The following user says thank you to yuriry for this useful post:

    rvega (6th May 2012)

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
  •  
Qt is a trademark of The Qt Company.