QWindowsStyle: fix CE_ComboBoxLabel text color

CE_ComboBoxLabel was relying on a font color / painter pen set
by CC_ComboBox. This change ensures that CE_ComboBoxLabel has
correct color when CC_ComboBox and CE_ComboBoxLabel are drawn
independently.

Change-Id: Id548d831fdde5885bc7c157d55de6235ef3f0a56
Task-number: QTBUG-41702
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
J-P Nurmi 2014-10-30 12:39:10 +01:00
parent f3fb787a32
commit 4387c5d6af

View File

@ -1821,6 +1821,20 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
} }
return; return;
#endif // QT_NO_DOCKWIDGET #endif // QT_NO_DOCKWIDGET
#ifndef QT_NO_COMBOBOX
case CE_ComboBoxLabel:
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
if (cb->state & State_HasFocus) {
p->setPen(cb->palette.highlightedText().color());
p->setBackground(cb->palette.highlight());
} else {
p->setPen(cb->palette.text().color());
p->setBackground(cb->palette.background());
}
}
QCommonStyle::drawControl(ce, opt, p, widget);
break;
#endif // QT_NO_COMBOBOX
default: default:
QCommonStyle::drawControl(ce, opt, p, widget); QCommonStyle::drawControl(ce, opt, p, widget);
} }