Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-52986

QDataWidgetMapper not submitting data with QSqlRelationalTableModel

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.5.1
    • Fix Version/s: None
    • Component/s: SQL Support
    • Labels:
      None
    • Environment:
      Windows 7 with sqlite database

      Description

      This problem might be related to Qt QTBUG-16299.

      The Qdatawidgetmapper combobox does not submit data to the database field. The combobox displays data from another table references using an id. But the selected id is not stored in the database.

      The database used in the example code is a sqlite database which is opened in initdb.h. Change the databasename to your own database. It creates the
      tables drivers and cars and inserts a couple of records.

      The mainwindow shows data from the cars table and the combobox shows the drivers lastname from the drivers table.
      You can select another driver in the combobox but this data is not stored.
      You can add a record in the cars table, but the drivers_id is left empty in the new record and the new record will not be showed in the form, although it does exist in the table.

        Attachments

        1. initdb.h
          2 kB
        2. main.cpp
          0.2 kB
        3. mainwindow.cpp
          3 kB
        4. mainwindow.h
          0.8 kB
        5. mainwindow.ui
          4 kB
        6. relationalcombo.pro
          0.4 kB
        7. relationalcombo.pro.user
          43 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              mabrand Mark Brand
              Reporter:
              gzijlstra Gerrit Zijlstra
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes