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

QDataWidgetMapper not submitting data with QSqlRelationalTableModel


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


      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.


        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.



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


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes