QComboBox: Disable items marked as disabled in native popups

Fixes: QTBUG-56064
Pick-to: 6.5 6.2 5.15
Change-Id: I00a17a19b4c14c874e16ec863e794218f0570346
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Sebastian Beckmann 2023-03-29 04:20:38 +02:00
parent a1ff7f518d
commit 9f44553b3d

View File

@ -2501,10 +2501,12 @@ bool QComboBoxPrivate::showNativePopup()
QVariant textVariant = model->data(rowIndex, Qt::EditRole);
item->setText(textVariant.toString());
QVariant iconVariant = model->data(rowIndex, Qt::DecorationRole);
const Qt::ItemFlags itemFlags = model->flags(rowIndex);
if (iconVariant.canConvert<QIcon>())
item->setIcon(iconVariant.value<QIcon>());
item->setCheckable(true);
item->setChecked(i == currentIndex);
item->setEnabled(itemFlags & Qt::ItemIsEnabled);
if (!currentItem || i == currentIndex)
currentItem = item;