Results 1 to 2 of 2

Thread: quick question on model/view programming

  1. #1
    Join Date
    Jan 2007
    Posts
    38
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default quick question on model/view programming

    Hi,

    Is there a way to check if changes made to a model (QSqlTableModel to be exact) has been submitted to the underlying sql database.

    Meaning we are using OnManualSubmit and the changes are cached in the model but we have not yet called submitAll().

    ie. i want to detect unsubmitted changes so i can warn my user before he/she closes the view.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: quick question on model/view programming

    You can either call submitAll() just in case there are any changes or connect to the dataChanged() signal in the model to keep your own track of data changes. If the signal fires, just set some flag that the model has pending changes and on quit just check that flag and act accordingly.

  3. The following user says thank you to wysota for this useful post:

    locus (2nd February 2007)

Similar Threads

  1. Using QGraphicsView with model/view programming
    By JLP in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2007, 11:04
  2. MODEL/VIEW programming and TABLES
    By newbie in forum Qt Programming
    Replies: 5
    Last Post: 27th August 2006, 21:26
  3. MODEL/VIEW programming
    By mira in forum Newbie
    Replies: 3
    Last Post: 21st April 2006, 11:19
  4. Replies: 2
    Last Post: 16th February 2006, 19:09
  5. Model/View Programming -- Signals
    By KjellKod in forum Qt Programming
    Replies: 17
    Last Post: 7th February 2006, 16:36

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.