Results 1 to 4 of 4

Thread: QDataWidgetMapper question

  1. #1
    Join Date
    Jun 2006
    Location
    San Jose, CA
    Posts
    53
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QDataWidgetMapper question

    Has anyone played with the QDataWidgetMapper in releation with a QSqlRelationalTableModel. In other words having an input mask for various table fields as well as showing the full table. When I insert a new record into the table it looks like the mapper is not submitting the data correct when using
    Qt Code:
    1. mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
    To copy to clipboard, switch view to plain text mode 

    Thanks.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QDataWidgetMapper question

    Exactly in what way does it not work correctly? I know it's a lot asked but could you prepare a minimal compilable example (which eg. creates a sqlite test db in memory) reproducing the problem so we could give it a try?
    J-P Nurmi

  3. #3
    Join Date
    Jun 2006
    Location
    San Jose, CA
    Posts
    53
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDataWidgetMapper question

    Hi,

    I attached the modified Qt books demo and you see the problem. Insert a new row and try to fill the fields. I also found the problem while I prepared that example. When you use
    Qt Code:
    1. model->setEditStrategy(QSqlTableModel::OnFieldChange);
    To copy to clipboard, switch view to plain text mode 

    instead of

    Qt Code:
    1. model->setEditStrategy(QSqlTableModel::OnManualSubmit);
    To copy to clipboard, switch view to plain text mode 

    you will notice that the when the fields get changed the are not changed in the table. Can someone explain to me the different behavior?

    Thanks in advance.
    Attached Files Attached Files

  4. #4
    Join Date
    Jun 2006
    Location
    San Jose, CA
    Posts
    53
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDataWidgetMapper question

    Another strange thing is when you use a mysql database and delete all rows (I added an delete button to the code example) you will have an empty row in the table left - QSQLITE will not show this problem.

    And one last thing I noticed if you insert a row but do not submit (the table will show *) the mapper works not correct (values will not be shown in the table)

    So, three open questions. I appricate any help.
    Many thanks
    Attached Files Attached Files

Similar Threads

  1. QDataWidgetMapper and QSqlRelationalTableModel problem
    By larry104 in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2007, 15:46
  2. Access to QSqlTableModel::isDirty Question.
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 12th April 2007, 17:49
  3. Question regarding how to paint after zoom.
    By JonathanForQT4 in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2007, 15:34
  4. QDataWidgetMapper <=> QComboBox best practice
    By saknopper in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2007, 10: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.