What is the expected behavior of the Sql Widget Mapper Example?



  • Hello, I am new to QT so I am going through the examples and learning but I have a question.

    When I open the Sql Widget Mapper Example and run it, the window pops up with a name, address and type. Tabbing out of the QLineEdit or the QTextEdit saves changes but selecting a different item in the QComboBox never gets saved. In the example, is pressing next or previous supposed to save changes to all the fields in the database? Or is the QComboBox being left out purposely? Thanks in advance..



  • I'm bumping this in hopes that someone will notice it and knows the answer. :)


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    AFAIK, the combo box should get saved and restored the same way the other widgets do



  • Ok. Thank you for your response. That's not whats happening on my computers. The changes made to the combo box do not get saved. This is an unaltered example that I'm using and I was thinking the intention of the example was to show how to save all the widget's changes (as you mentioned). I'm having troubles figuring out why they aren't.


  • Lifetime Qt Champion

    Which version of Qt and OS are you running ?



  • I am using the following:

    Qt 5.3.2

    Mac - Yosemite (10.10.1)
    Windows - 8

    Mac / Windows yield the same result.

    I thought maybe it had something to do with not submitting:
    @model->setEditStrategy(QSqlTableModel::OnManualSubmit);
    @

    But I am not sure because it also doesn't work with OnFieldChange & OnRowChange


  • Lifetime Qt Champion

    Indeed, it does, I've mixed it with another example. That one just enables you to "browse" the database content.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.