summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2011-04-12 11:55:46 (GMT)
committerJens Bache-Wiig <jens.bache-wiig@nokia.com>2011-04-12 11:57:22 (GMT)
commite89a2b72050dd782da16ff24bc2eb84dc36ed6a5 (patch)
treea3586ebe17bbc98591575de731faebd542249bfc /src
parentb10265efba544b1e4820f45b86354d442f6abf26 (diff)
downloadQt-e89a2b72050dd782da16ff24bc2eb84dc36ed6a5.zip
Qt-e89a2b72050dd782da16ff24bc2eb84dc36ed6a5.tar.gz
Qt-e89a2b72050dd782da16ff24bc2eb84dc36ed6a5.tar.bz2
Fix incorrect rendering of checked menu items on Windows Classic
Modify rendering of checked menu items when using Windows Classic style to be more native looking. Changes: * Checked menu items with no icon are not drawn sunken * Disabled checked menu items with an icon have a plain background instead of a checkerboard pattern same as when enabled * Check mark is drawn with highlighted text color when selected to match text * Fix check mark offset for disabled unselected checked menu item as the entire check mark was drawn shifted (1, 1) * Fix color of check mark shadow for disabled unselected checked menu item as it was same color as the check mark when it should be a light color Task-number: QTBUG-15098 Merge-request: 2513 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/styles/qcommonstyle.cpp13
-rw-r--r--src/gui/styles/qwindowsstyle.cpp4
2 files changed, 7 insertions, 10 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 8f99d6a..3d04c9a 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -223,16 +223,13 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
--yy;
}
if (!(opt->state & State_Enabled) && !(opt->state & State_On)) {
- int pnt;
- p->setPen(opt->palette.highlightedText().color());
- QPoint offset(1, 1);
- for (pnt = 0; pnt < a.size(); ++pnt)
- a[pnt].translate(offset.x(), offset.y());
+ p->save();
+ p->translate(1, 1);
+ p->setPen(opt->palette.light().color());
p->drawLines(a);
- for (pnt = 0; pnt < a.size(); ++pnt)
- a[pnt].translate(offset.x(), offset.y());
+ p->restore();
}
- p->setPen(opt->palette.text().color());
+ p->setPen((opt->state & State_On) ? opt->palette.highlightedText().color() : opt->palette.text().color());
p->drawLines(a);
break; }
case PE_Frame:
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 44f3f92..1dcfd00 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -1858,8 +1858,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
}
QRect vCheckRect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x(), menuitem->rect.y(), checkcol, menuitem->rect.height()));
- if (checked) {
- if (act && !dis) {
+ if (!menuitem->icon.isNull() && checked) {
+ if (act) {
qDrawShadePanel(p, vCheckRect,
menuitem->palette, true, 1,
&menuitem->palette.brush(QPalette::Button));