QMacStyle: Revert state changes for PE_IndicatorMenuCheckMark

The changes introduced in 0e810e27a5
turn out to be incompatible with our style sheets styling. We
partially revert the style option state check, so that the look
for a highlighted PE_IndicatorMenuCheckMark only depends on
State_On, as it's expected in QWindowsStyle and QCommonStyle.

[ChangeLog][QtWidgets][QMacStyle] PE_IndicatorMenuCheckMark
goes back to only depend on State_On for its highlighted look.

Change-Id: I20f8e712196b5515bd5528ff6eedcdca9df5856f
Task-number: QTBUG-65773
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
This commit is contained in:
Gabriel de Dietrich 2018-01-15 12:59:22 -08:00 committed by Jani Heikkinen
parent 2afc8e3ad6
commit 0d9208cecb

View File

@ -3389,13 +3389,12 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
}
break;
case PE_IndicatorMenuCheckMark: {
if (!(opt->state & State_On))
break;
QColor pc;
if (opt->state & State_Selected)
if (opt->state & State_On)
pc = opt->palette.highlightedText().color();
else
pc = opt->palette.text().color();
QCFType<CGColorRef> checkmarkColor = CGColorCreateGenericRGB(static_cast<CGFloat>(pc.redF()),
static_cast<CGFloat>(pc.greenF()),
static_cast<CGFloat>(pc.blueF()),
@ -4493,8 +4492,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
const int xp = contentRect.x() + macItemFrame;
checkmarkOpt.rect = QRect(xp, contentRect.y() - checkmarkOpt.fontMetrics.descent(), mw, mh);
checkmarkOpt.state |= State_On; // Always on. Never rendered when off.
checkmarkOpt.state.setFlag(State_Selected, active);
checkmarkOpt.state.setFlag(State_On, active);
checkmarkOpt.state.setFlag(State_Enabled, enabled);
if (widgetSize == QAquaSizeMini)
checkmarkOpt.state |= State_Mini;