Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.2
-
None
-
00edad4373d394ed9f828b1fa887003f87c5fa6f
Description
When using a multicolumn view choosing a item from the popup will does not respect modelColumn(), instead it shows the selected column
in the combobox.
The problem comes from QComboBoxPrivateContainer::eventFilter because it passes the selected modelindex instead of creating a own
with the selected row and modelColumn().
Alternatively QComboBoxPrivate::setCurrentIndex could recreate the passed index with the modelColumn:
changed setCurrentIndex
void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi) { Q_Q(QComboBox); QModelIndex normalized = q->model()->index(mi.row(),q->modelColumn(),mi.parent()); if(!normalized.isValid()) normalized = mi; //fallback to passed index bool indexChanged = (normalized!= currentIndex); if (indexChanged) currentIndex = QPersistentModelIndex(normalized); if (lineEdit) { QString newText = q->itemText(normalized.row()); if (lineEdit->text() != newText) lineEdit->setText(newText); updateLineEditGeometry(); } if (indexChanged) { q->update(); _q_emitCurrentIndexChanged(currentIndex); } }