src/gui/styles/qstylesheetstyle.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 22 79de32ba3296
--- a/src/gui/styles/qstylesheetstyle.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/styles/qstylesheetstyle.cpp	Fri Apr 16 15:50:13 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -1125,6 +1125,7 @@
 
 void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect)
 {
+    setClip(p, rect);
     static const Qt::TileRule tileMode2TileRule[] = {
         Qt::StretchTile, Qt::RoundTile, Qt::StretchTile, Qt::RepeatTile, Qt::StretchTile };
 
@@ -1142,6 +1143,7 @@
                       QRect(QPoint(), borderImageData->pixmap.size()), sourceMargins,
                       QTileRules(tileMode2TileRule[borderImageData->horizStretch], tileMode2TileRule[borderImageData->vertStretch]));
     p->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothPixmapTransform);
+    unsetClip(p);
 }
 
 QRect QRenderRule::originRect(const QRect &rect, Origin origin) const
@@ -5611,9 +5613,6 @@
     case SE_ItemViewItemFocusRect:
         if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
             QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem);
-            QStyleOptionViewItemV4 optCopy(*vopt);
-            optCopy.rect = subRule.contentsRect(vopt->rect);
-            QRect rect = ParentStyle::subElementRect(se, &optCopy, w);
             PseudoElement pe = PseudoElement_None;
             if (se == SE_ItemViewItemText || se == SE_ItemViewItemFocusRect)
                 pe = PseudoElement_ViewItemText;
@@ -5623,8 +5622,13 @@
                 pe = PseudoElement_ViewItemIndicator;
             else
                 break;
-            QRenderRule subRule2 = renderRule(w, opt, pe);
-            return positionRect(w, subRule2, pe, rect, opt->direction);
+            if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || hasStyleRule(w, pe)) {
+                QRenderRule subRule2 = renderRule(w, opt, pe);
+                QStyleOptionViewItemV4 optCopy(*vopt);
+                optCopy.rect = subRule.contentsRect(vopt->rect);
+                QRect rect = ParentStyle::subElementRect(se, &optCopy, w);
+                return positionRect(w, subRule2, pe, rect, opt->direction);
+            }
          }
         break;
 #endif // QT_NO_ITEMVIEWS
@@ -5739,6 +5743,13 @@
         return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction);
                                    }
 
+#ifndef QT_NO_TOOLBAR
+    case SE_ToolBarHandle:
+        if (hasStyleRule(w, PseudoElement_ToolBarHandle))
+            return ParentStyle::subElementRect(se, opt, w);
+        break;
+#endif //QT_NO_TOOLBAR
+
     default:
         break;
     }