summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-08-11 19:02:51 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-08-11 19:06:42 (GMT)
commitb564809ddc3d894b31eff58833e4b71f9e7ae7a2 (patch)
tree755793be81d9e0abe9a566589652dab72aedfed2
parent4d2436df6e4af090158adaa916dedf7ee5f757f0 (diff)
downloadQt-b564809ddc3d894b31eff58833e4b71f9e7ae7a2.zip
Qt-b564809ddc3d894b31eff58833e4b71f9e7ae7a2.tar.gz
Qt-b564809ddc3d894b31eff58833e4b71f9e7ae7a2.tar.bz2
QMenuBar does not respect the border-image stylesheet property
Added WA_StyledBackground to QMenuBar when using style sheets. This also implies that CE_PanelMenuBar (drawing only the menubar border) no longer needs to be drawn. Tested in uiloader/baselne/css_borderimage_allwidgets.ui. Task-number: 230363 Reviewed-by: olivier
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 5f6d4ab..7523883 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -2734,6 +2734,9 @@ void QStyleSheetStyle::polish(QWidget *w)
#ifndef QT_NO_MDIAREA
|| qobject_cast<QMdiSubWindow *>(w)
#endif
+#ifndef QT_NO_MENUBAR
+ || qobject_cast<QMenuBar *>(w)
+#endif
|| qobject_cast<QDialog *>(w)) {
w->setAttribute(Qt::WA_StyledBackground, true);
}
@@ -3456,6 +3459,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
case CE_MenuEmptyArea:
case CE_MenuBarEmptyArea:
if (rule.hasDrawable()) {
+ // Drawn by PE_Widget
return;
}
break;
@@ -3606,6 +3610,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
subRule.drawRule(p, opt->rect);
QCommonStyle::drawControl(ce, &mi, p, w);
} else {
+ if (rule.hasDrawable() && !(opt->state & QStyle::State_Selected)) {
+ // So that the menu bar background is not hidden by the items
+ mi.palette.setColor(QPalette::Window, Qt::transparent);
+ mi.palette.setColor(QPalette::Button, Qt::transparent);
+ }
baseStyle()->drawControl(ce, &mi, p, w);
}
}
@@ -4189,7 +4198,6 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
#endif
//fall tghought
case PE_PanelMenu:
- case PE_PanelMenuBar:
case PE_PanelStatusBar:
if(rule.hasDrawable()) {
rule.drawRule(p, opt->rect);
@@ -4197,6 +4205,13 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
}
break;
+ case PE_PanelMenuBar:
+ if (rule.hasDrawable()) {
+ // Drawn by PE_Widget
+ return;
+ }
+ break;
+
case PE_IndicatorToolBarSeparator:
case PE_IndicatorToolBarHandle: {
PseudoElement ps = pe == PE_IndicatorToolBarHandle ? PseudoElement_ToolBarHandle : PseudoElement_ToolBarSeparator;