diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 2f36e0e..ffaa721 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3527,6 +3527,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q return; case CE_MenuItem: + qDebug() << __FUNCTION__ << "CE_MenuItem"; if (const QStyleOptionMenuItem *m = qstyleoption_cast(opt)) { QStyleOptionMenuItem mi(*m); @@ -3600,7 +3601,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q QRect textRect = subRule.contentsRect(opt->rect); textRect.setWidth(textRect.width() - mi.tabWidth); QString s = mi.text; - p->setPen(mi.palette.buttonText().color()); + const QColor c = mi.palette.buttonText().color(); + qDebug() << __FUNCTION__ << c; + p->setPen(c); if (!s.isEmpty()) { int text_flags = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; if (!styleHint(SH_UnderlineShortcut, &mi, w)) @@ -3609,9 +3612,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if (t >= 0) { QRect vShortcutRect = visualRect(opt->direction, mi.rect, QRect(textRect.topRight(), QPoint(mi.rect.right(), textRect.bottom()))); + qDebug() << __FUNCTION__ << s.mid(t + 1) << p->pen().color(); p->drawText(vShortcutRect, text_flags, s.mid(t + 1)); s = s.left(t); } + qDebug() << __FUNCTION__ << s.left(t) << p->pen().color(); p->drawText(textRect, text_flags, s.left(t)); } @@ -3622,6 +3627,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q drawPrimitive(arrow, &mi, p, w); } } else if (hasStyleRule(w, PseudoElement_MenuCheckMark) || hasStyleRule(w, PseudoElement_MenuRightArrow)) { + qDebug() << __FUNCTION__ << "QWindowsStyle::drawControl"; QWindowsStyle::drawControl(ce, &mi, p, w); if (mi.checkType != QStyleOptionMenuItem::NotCheckable && !mi.checked) { // We have a style defined, but QWindowsStyle won't draw anything if not checked. @@ -3650,8 +3656,10 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q mi.palette.setColor(QPalette::Button, Qt::transparent); } if (rule.baseStyleCanDraw() && subRule.baseStyleCanDraw()) { + qDebug() << __FUNCTION__ << baseStyle() << "baseStyle()->drawControl"; baseStyle()->drawControl(ce, &mi, p, w); } else { + qDebug() << __FUNCTION__ << "ParentStyle::drawControl"; ParentStyle::drawControl(ce, &mi, p, w); } } diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 9ab8f8f..853691e 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -1176,7 +1176,9 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai menuitem->rect.height() - 2 * QWindowsStylePrivate::windowsItemFrame)); proxy()->drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget); } - p->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color()); + const QColor c =act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color(); + qDebug() << __FUNCTION__ << c; + p->setPen(c); QColor discol; if (dis) { @@ -1202,9 +1204,11 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom()))); if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) { p->setPen(menuitem->palette.light().color()); + qDebug() << __FUNCTION__ << s.mid(t + 1) << p->pen().color(); p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1)); p->setPen(discol); } + qDebug() << __FUNCTION__ << s.mid(t + 1) << p->pen().color(); p->drawText(vShortcutRect, text_flags, s.mid(t + 1)); s = s.left(t); } @@ -1214,9 +1218,11 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->setFont(font); if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) { p->setPen(menuitem->palette.light().color()); + qDebug() << __FUNCTION__ << s.left(t) << p->pen().color(); p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t)); p->setPen(discol); } + qDebug() << __FUNCTION__ << s.left(t) << p->pen().color(); p->drawText(vTextRect, text_flags, s.left(t)); p->restore(); } diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 2f36944..107fde5 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1338,11 +1338,14 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption painter->drawPixmap(pmr.topLeft(), pixmap); } - painter->setPen(menuitem->palette.buttonText().color()); + const QColor c = menuitem->palette.buttonText().color(); + painter->setPen(c); + qDebug() << __FUNCTION__ << 'c' << c; QColor discol; if (dis) { discol = menuitem->palette.text().color(); + qDebug() << __FUNCTION__ << 'd' << discol; painter->setPen(discol); } @@ -1361,6 +1364,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption if (t >= 0) { QRect vShortcutRect = visualRect(option->direction, menuitem->rect, QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom()))); + qDebug() << __FUNCTION__ << 's' << s.mid(t + 1) << painter->pen().color(); painter->drawText(vShortcutRect, text_flags, s.mid(t + 1)); s = s.left(t); } @@ -1368,7 +1372,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); painter->setFont(font); - painter->setPen(discol); + painter->setPen(discol); // COLOR IS CLEARED HERE + qDebug() << __FUNCTION__ << 't' << s.left(t) << painter->pen().color(); painter->drawText(vTextRect, text_flags, s.left(t)); painter->restore(); } diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 63ed3ef..a982b8a 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -2260,6 +2260,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op QColor textColor = dis ? menuitem->palette.text().color() : act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color(); + qDebug() << __FUNCTION__ << textColor; p->setPen(textColor); // draw text ------------------------------------------------------ @@ -2278,10 +2279,13 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op if (t >= 0) { QRect vShortcutRect = visualRect(option->direction, option->rect, QRect(textRect.topRight(), menuitem->rect.bottomRight())); if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) { - p->setPen(menuitem->palette.light().color()); + const QColor sc = menuitem->palette.light().color(); + p->setPen(sc); + qDebug() << __FUNCTION__ << s.mid(t + 1) << p->pen().color(); p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1)); p->setPen(textColor); } + qDebug() << __FUNCTION__ << s.mid(t + 1) << p->pen().color(); p->drawText(vShortcutRect, text_flags, s.mid(t + 1)); s = s.left(t); } @@ -2291,9 +2295,11 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op p->setFont(font); if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) { p->setPen(menuitem->palette.light().color()); + qDebug() << __FUNCTION__ << s.left(t) << p->pen().color(); p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t)); p->setPen(textColor); } + qDebug() << __FUNCTION__ << s << p->pen().color(); p->drawText(vTextRect, text_flags, s); p->restore(); }