Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    General and Desktop
    2
    7
    1267
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JosephMorgan last edited by

      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..

      1 Reply Last reply Reply Quote 0
      • J
        JosephMorgan last edited by

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

        1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi and welcome to devnet,

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 0
          • J
            JosephMorgan last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              Which version of Qt and OS are you running ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply Reply Quote 0
              • J
                JosephMorgan last edited by

                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

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

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

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post