Respect Qt::FontRole for QComboBox items.

Change-Id: I810ae2d77109a36b457f07e4a7b0489c954279e8
Task-number: QTBUG-41131
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Mitch Curtis 2014-09-15 15:48:42 +02:00
parent 16b72baf2e
commit 6ecc1e8006

View File

@ -165,10 +165,15 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt
if (mCombo->testAttribute(Qt::WA_SetFont)
|| mCombo->testAttribute(Qt::WA_MacSmallSize)
|| mCombo->testAttribute(Qt::WA_MacMiniSize)
|| mCombo->font() != qt_app_fonts_hash()->value("QComboBox", QFont()))
|| mCombo->font() != qt_app_fonts_hash()->value("QComboBox", QFont())) {
menuOption.font = mCombo->font();
else
menuOption.font = qt_app_fonts_hash()->value("QComboMenuItem", mCombo->font());
} else {
QVariant fontRoleData = index.data(Qt::FontRole);
if (fontRoleData.isValid())
menuOption.font = fontRoleData.value<QFont>();
else
menuOption.font = qt_app_fonts_hash()->value("QComboMenuItem", mCombo->font());
}
menuOption.fontMetrics = QFontMetrics(menuOption.font);