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:
parent
f3fb787a32
commit
4387c5d6af
@ -1821,6 +1821,20 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|
||||
}
|
||||
return;
|
||||
#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:
|
||||
QCommonStyle::drawControl(ce, opt, p, widget);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user