Results 1 to 2 of 2

Thread: Fill a data record in the beforeInsert slot

  1. #1
    Join Date
    Sep 2008
    Location
    Portugal
    Posts
    171
    Thanks
    57
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Fill a data record in the beforeInsert slot

    Hi,

    Imagine i have this:
    Qt Code:
    1. void Dialog::beforeInsertX(QSqlRecord &record)
    2. {
    3. record.setValue("id", generateId("tablename"));
    4. record.setValue("a", "xxx");
    5. record.setValue("b", "yyy");
    6. ...
    7. }
    8.  
    9. void Dialog::insertX()
    10. {
    11.  
    12. int row = model->rowCount();
    13. model->insertRow(row);
    14. // ???
    15. }
    To copy to clipboard, switch view to plain text mode 

    What showl i type in the // ??? in order to have model and view sinchronized when no editing is necessary?

    Thanks

  2. #2
    Join Date
    Sep 2008
    Location
    Portugal
    Posts
    171
    Thanks
    57
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Fill a data record in the beforeInsert slot

    grrrrr ... christ!!
    Must be related to the http://doc.trolltech.com/4.5/qsqltab...tStrategy-enum because after a model->submitall(); it is working fine.

Similar Threads

  1. Selected Record...
    By Nefastious in forum Newbie
    Replies: 1
    Last Post: 27th October 2009, 10:54
  2. Inserting Record
    By Nefastious in forum Newbie
    Replies: 3
    Last Post: 20th October 2009, 05:28
  3. disconnect SIGNAL/SLOT directly after emitting data
    By donglebob in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2009, 23:53
  4. Not corect record pos in data table after update
    By zlatko in forum Qt Programming
    Replies: 3
    Last Post: 1st May 2006, 17:51
  5. Record update windowd entered data saving
    By MarkoSan in forum Qt Programming
    Replies: 56
    Last Post: 18th January 2006, 19:50

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.