diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-08-19 08:15:38 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-08-19 08:18:18 (GMT) |
commit | ca0b5b503e8865c0eedeea86aa132291281fc49f (patch) | |
tree | 1eca392e65bf5be617a5189d93a8327cc9ec5e34 /src/gui/styles/qstylesheetstyle.cpp | |
parent | f21096e918a587287d61446e930c40914e2b7ce5 (diff) | |
parent | 23d2550e6d19c3e84ff2167f5696d4b6dd3f49d4 (diff) | |
download | Qt-ca0b5b503e8865c0eedeea86aa132291281fc49f.zip Qt-ca0b5b503e8865c0eedeea86aa132291281fc49f.tar.gz Qt-ca0b5b503e8865c0eedeea86aa132291281fc49f.tar.bz2 |
Merge branch 'master' into mmfphonon
Conflicts:
src/gui/itemviews/qitemselectionmodel.cpp
tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
Diffstat (limited to 'src/gui/styles/qstylesheetstyle.cpp')
-rw-r--r-- | src/gui/styles/qstylesheetstyle.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 5f6d4ab..8ac811c 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -1298,7 +1298,6 @@ void QRenderRule::unsetClip(QPainter *p) void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& off) { - setClip(p, borderRect(rect)); QBrush brush = hasBackground() ? background()->brush : QBrush(); if (brush.style() == Qt::NoBrush) brush = defaultBackground; @@ -1306,11 +1305,19 @@ void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& o if (brush.style() != Qt::NoBrush) { Origin origin = hasBackground() ? background()->clip : Origin_Border; // ### fix for gradients - p->fillRect(originRect(rect, origin), brush); + const QPainterPath &borderPath = borderClip(originRect(rect, origin)); + if (!borderPath.isEmpty()) { + // Drawn intead of being used as clipping path for better visual quality + bool wasAntialiased = p->renderHints() & QPainter::Antialiasing; + p->setRenderHint(QPainter::Antialiasing); + p->fillPath(borderPath, brush); + p->setRenderHint(QPainter::Antialiasing, wasAntialiased); + } else { + p->fillRect(originRect(rect, origin), brush); + } } drawBackgroundImage(p, rect, off); - unsetClip(p); } void QRenderRule::drawFrame(QPainter *p, const QRect& rect) @@ -2734,6 +2741,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 +3466,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 +3617,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 +4205,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 +4212,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; |