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 <jens.bache-wiig@digia.com>
This commit is contained in:
Friedemann Kleint 2014-01-21 11:17:50 +01:00 committed by The Qt Project
parent 4c4f336160
commit b152b425f7

View File

@ -1340,11 +1340,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;
@ -1368,7 +1366,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();
}