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; break;
case PE_IndicatorMenuCheckMark: { case PE_IndicatorMenuCheckMark: {
if (!(opt->state & State_On))
break;
QColor pc; QColor pc;
if (opt->state & State_Selected) if (opt->state & State_On)
pc = opt->palette.highlightedText().color(); pc = opt->palette.highlightedText().color();
else else
pc = opt->palette.text().color(); pc = opt->palette.text().color();
QCFType<CGColorRef> checkmarkColor = CGColorCreateGenericRGB(static_cast<CGFloat>(pc.redF()), QCFType<CGColorRef> checkmarkColor = CGColorCreateGenericRGB(static_cast<CGFloat>(pc.redF()),
static_cast<CGFloat>(pc.greenF()), static_cast<CGFloat>(pc.greenF()),
static_cast<CGFloat>(pc.blueF()), static_cast<CGFloat>(pc.blueF()),
@ -4493,8 +4492,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
const int xp = contentRect.x() + macItemFrame; const int xp = contentRect.x() + macItemFrame;
checkmarkOpt.rect = QRect(xp, contentRect.y() - checkmarkOpt.fontMetrics.descent(), mw, mh); 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_On, active);
checkmarkOpt.state.setFlag(State_Selected, active);
checkmarkOpt.state.setFlag(State_Enabled, enabled); checkmarkOpt.state.setFlag(State_Enabled, enabled);
if (widgetSize == QAquaSizeMini) if (widgetSize == QAquaSizeMini)
checkmarkOpt.state |= State_Mini; checkmarkOpt.state |= State_Mini;