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
          Gerrit Zijlstra
        2. main.cpp
          0.2 kB
          Gerrit Zijlstra
        3. mainwindow.cpp
          3 kB
          Gerrit Zijlstra
        4. mainwindow.h
          0.8 kB
          Gerrit Zijlstra
        5. mainwindow.ui
          4 kB
          Gerrit Zijlstra
        6. relationalcombo.pro
          0.4 kB
          Gerrit Zijlstra
        7. relationalcombo.pro.user
          43 kB
          Gerrit Zijlstra
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            mabrand Mark Brand
            gzijlstra Gerrit Zijlstra
            0 Vote for this issue
            1 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes