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

QComboBox's currentIndex() changes from -1 to 0 when adding data to an empty model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P2: Important P2: Important
    • None
    • 5.15.0
    • None
    • Linux/X11

      The issue appears to be this change: https://code.qt.io/cgit/qt/qtbase.git/commit/src/widgets/widgets/qcombobox.cpp?id=a4ea0d9eacd574a6a96f70b138dcb111e9d11d21

      Before that change, after a model was set, `currentIndex()` would be set to -1 and an editable combobox would not have any text in the edit line. After that change, setting the model would cause `currentIndex()` to be set to 0 and the line edit to be filled with the first entry from the model.

      This changes the behavior of existing applications. See https://bugs.kde.org/show_bug.cgi?id=426800 for an example.

        1. testqcombo.cpp
          0.8 kB
        2. qtbug_86791.cpp
          0.3 kB
        3. qt-5.15-combobox.webm
          402 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            chehrlic Christian Ehrlicher
            guss77 Oded Arbel
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes