QComboBox: don't call data(invalid index) on the underlying model
QComboBoxPrivate::itemIcon() wasn't checking for an invalid index, unlike QComboBoxPrivate::itemText(). QComboBoxPrivate::setCurrentIndex calls updateLineEditGeometry, which calls QComboBox::itemIcon, even for an invalid combobox. Pick-to: 6.5 6.2 Change-Id: I5e6105ae56836cd237a91a405d331f1424f49b37 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
dae858b710
commit
fed4c3ecba
@ -1726,6 +1726,8 @@ void QComboBoxPrivate::updateDelegate(bool force)
|
||||
|
||||
QIcon QComboBoxPrivate::itemIcon(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return {};
|
||||
QVariant decoration = model->data(index, Qt::DecorationRole);
|
||||
if (decoration.userType() == QMetaType::QPixmap)
|
||||
return QIcon(qvariant_cast<QPixmap>(decoration));
|
||||
|
Loading…
x
Reference in New Issue
Block a user