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

QComboBox no longer works usefuly with default item delegate because index is USER property



    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 4.8.x
    • Fix Version/s: 4.8.3, 5.0.0
    • Component/s: Widgets: Itemviews
    • Labels:
    • Environment:
      Mac 10.7.4 and Windows 7
    • Commits:
      816c5540179362500dfc175b77f05abf3ef25233 8a205983c47a8fc3f145af0c9d5443dd939950de 84787d82ee9369b2a83c5b0568ee62ab602a5528


      I have a QSqlTableModel with index 1 of the model mapped to a QComboBox. Data appears correctly in the CB, however when I click on an "Edit" button which displays a QInputDialog with the value from the CB, the data in the model at index 0 changes to the index of the value selected in the CB. I checked the data before the dialog is called and it is correct. The data in the dialog is correct but if I cancel the dialog and display the contents of the model, the data has changed. For instance:

      Before call to the QInputDialog
      Rig One
      Rig Two <-- this is the current index, the one selected from the CB.

      Post call
      Rig Two

      If I then select the first index, now value "1" and cancel, it changes to "O".

      In another case with another CB, something similar happens except the selected data itself is replaced with its index, like the following:

      Rig One
      Rig Two <-- this is the current index, the one selected from the CB.

      Post call
      Rig One

      Selecting "Rig One" and canceling cause it's value to change to "0". In this case, though, while the dialog is displayed I can see in the CB that its value has already changed even though the data displayed in the Dialog is correct.

      In two other areas where I use CBs in the exact manner, everything works perfectly.

      In addition, in Qt 4.7.4 all the code works perfect – no issues whatsoever (verified)


        1. Archive.zip
          17 kB
        2. Qt_problems.txt
          6 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            mabrand Mark Brand
            mtnbiker66 Scott Hollen
            0 Vote for this issue
            5 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes