From 40db54f8182e427f76c663aec15c3a6a682b3c9f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Jan 2014 11:17:50 +0100 Subject: QWindowVistaStyle: Always initialize text color of menu items. [ChangeLog][QtWidgets][QMenu][Windows] Correctly use text color set by style sheet for menu items. Task-number: QTBUG-36142 Change-Id: I142f2fd82164771b45bf599a6afa1121fcfd2187 Reviewed-by: Jens Bache-Wiig (cherry picked from qtbase/b152b425f74788b2f2845fb7d1a5032d86b8746d) --- src/gui/styles/qwindowsvistastyle.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index c14dfb5..abe729b 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -1344,11 +1344,9 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption painter->setPen(menuitem->palette.buttonText().color()); - QColor discol; - if (dis) { - discol = menuitem->palette.text().color(); - painter->setPen(discol); - } + const QColor textColor = menuitem->palette.text().color(); + if (dis) + painter->setPen(textColor); int xm = windowsItemFrame + checkcol + windowsItemHMargin; int xpos = menuitem->rect.x() + xm; @@ -1372,7 +1370,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); painter->setFont(font); - painter->setPen(discol); + painter->setPen(textColor); painter->drawText(vTextRect, text_flags, s.left(t)); painter->restore(); } -- cgit v0.12