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

QComboBox showPopup doesn't select all columns of an item

XMLWordPrintable

    • All
    • b3b28faf2627aad3a0c47fb4c7c711e0d19984aa (qt/qtbase/dev) 3f2b5fdf48e32ee01bcc1154adef5b3c530fb9bc (qt/qtbase/6.0) c3d8270f2f0bf379ecb4aa868c4feefb3ca181ed (qt/tqtc-qtbase/tqtc/lts-5.15)

      Hi,

      I have a custom QComboBox which popup uses a multi-column view. When I click on the comboBox to open the popup, only the first column of a row gets selected. If I move my mouse around, all columns are getting properly selected.

      While digging in the source code to understand what was happening (with the hope to find a flag to set on the comboBox), I noticed that qcombobox.cpp, line 2666, in the showPopup() function, the select call goes as follow:

      view()>selectionModel()>setCurrentIndex(d->currentIndex, QItemSelectionModel::ClearAndSelect);

      QItemSelectionModel::ClearAndSelect only selects the first column of the row.

      It should be: QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows to select all columns of the row.

      Seems fairly benign to do this change, but maybe this should be an additional flag on the qcombobox.

      Thanks,

      Eric

       

        1. combobox_multicolumn.py
          2 kB
          Eric Smolikowski
        2. image-2021-01-04-11-10-36-761.png
          9 kB
          Eric Smolikowski
        3. main.cpp
          0.6 kB
          Christian Ehrlicher
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            chehrlic Christian Ehrlicher
            esmolikowski Eric Smolikowski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes