diff -r -u -N /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/graphicsview.pri ./graphicsview.pri
--- /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/graphicsview.pri	2010-02-11 10:55:22.000000000 -0500
+++ ./graphicsview.pri	2010-05-05 19:18:59.000000000 -0400
@@ -26,7 +26,8 @@
     graphicsview/qgraph_p.h \
     graphicsview/qsimplex_p.h \
     graphicsview/qgraphicsanchorlayout_p.h \
-    graphicsview/qgraphicsanchorlayout.h
+    graphicsview/qgraphicsanchorlayout.h \
+    graphicsview/rect_merge_util.h
 
 SOURCES += graphicsview/qgraphicsgridlayout.cpp \
     graphicsview/qgraphicsitem.cpp \
@@ -49,4 +50,6 @@
     graphicsview/qgridlayoutengine.cpp \
     graphicsview/qsimplex_p.cpp \
     graphicsview/qgraphicsanchorlayout_p.cpp \
-    graphicsview/qgraphicsanchorlayout.cpp
+    graphicsview/qgraphicsanchorlayout.cpp \
+    graphicsview/rect_merge_util.cpp
+    
diff -r -u -N /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/qgraphicsitem.cpp ./qgraphicsitem.cpp
--- /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/qgraphicsitem.cpp	2010-04-26 16:36:47.000000000 -0400
+++ ./qgraphicsitem.cpp	2010-05-05 19:11:41.000000000 -0400
@@ -694,6 +694,8 @@
 
 #include <math.h>
 
+#include "rect_merge_util.h"
+
 QT_BEGIN_NAMESPACE
 
 static inline void _q_adjustRect(QRect *rect)
@@ -5391,7 +5393,7 @@
                 cache->allExposed = true;
                 cache->exposed.clear();
             } else {
-                cache->exposed.append(rect);
+                rectMergeToList(cache->exposed,rect);
             }
         }
         // Only invalidate cache; item is already dirty.
@@ -5452,7 +5454,7 @@
 
                 // Translate the existing expose.
                 foreach (QRectF exposedRect, c->exposed)
-                    c->exposed += exposedRect.translated(dx, dy) & rect;
+                    rectMergeToList(c->exposed, exposedRect.translated(dx, dy) & rect);
 
                 // Calculate exposure.
                 QRegion exposed;
diff -r -u -N /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/qgraphicsscene.cpp ./qgraphicsscene.cpp
--- /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/qgraphicsscene.cpp	2010-02-11 10:55:22.000000000 -0500
+++ ./qgraphicsscene.cpp	2010-05-05 19:44:21.000000000 -0400
@@ -253,6 +253,8 @@
 #include <private/qgesturemanager_p.h>
 #include <private/qpathclipper_p.h>
 
+#include "rect_merge_util.h"
+
 // #define GESTURE_DEBUG
 #ifndef GESTURE_DEBUG
 # define DEBUG if (0) qDebug
@@ -4386,10 +4388,9 @@
 
             // Generate the item's exposedRect and map its list of expose
             // rects to device coordinates.
-            styleOptionTmp = *option;
             QRegion pixmapExposed;
             QRectF exposedRect;
-            if (!itemCache->allExposed) {
+/*            if (!itemCache->allExposed) {
                 for (int i = 0; i < itemCache->exposed.size(); ++i) {
                     QRectF r = itemCache->exposed.at(i);
                     exposedRect |= r;
@@ -4398,11 +4399,25 @@
             } else {
                 exposedRect = brect;
             }
-            styleOptionTmp.exposedRect = exposedRect;
-
+*/
             // Render.
-            _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(),
-                              &styleOptionTmp, painterStateProtection);
+            if (itemCache->allExposed) {
+                styleOptionTmp = *option;
+                styleOptionTmp.exposedRect = brect;
+
+                _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(),
+                                  &styleOptionTmp, painterStateProtection);
+            } else {
+                for (int i = 0; i < itemCache->exposed.size(); ++i) {
+                    const QRectF& r = itemCache->exposed.at(i);
+                    styleOptionTmp = *option;
+                    styleOptionTmp.exposedRect = r;
+
+                    pixmapExposed = itemToPixmap.mapRect(r).toAlignedRect();
+                    _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(),
+                                      &styleOptionTmp, painterStateProtection);
+                }
+            }
 
             // insert this pixmap into the cache.
             itemCache->key = QPixmapCache::insert(pix);
@@ -4556,7 +4571,7 @@
 
             // Calculate the style option's exposedRect.
             QRectF br;
-            if (itemCache->allExposed) {
+/*            if (itemCache->allExposed) {
                 br = item->boundingRect();
             } else {
                 const QVector<QRectF> &exposed = itemCache->exposed;
@@ -4565,13 +4580,34 @@
                 QTransform pixmapToItem = itemToPixmap.inverted();
                 foreach (QRect r, scrollExposure.rects())
                     br |= pixmapToItem.mapRect(r);
-            }
-            styleOptionTmp = *option;
-            styleOptionTmp.exposedRect = br.adjusted(-1, -1, 1, 1);
+            }*/
+
+            if (itemCache->allExposed) {
+                styleOptionTmp = *option;
+                styleOptionTmp.exposedRect = br.adjusted(-1, -1, 1, 1);
+
+                // Render the exposed areas.
+                _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(),
+                                  &styleOptionTmp, painterStateProtection);
+            } else {
+                // Have to filter expanded rects, because they can intersect
+                QVector<QRectF> exposed;
+                for (int i = 0; i < itemCache->exposed.size(); ++i)
+                    rectMergeToList(exposed,itemCache->exposed.at(i).adjusted(-1, -1, 1, 1));
+                QTransform pixmapToItem = itemToPixmap.inverted();
+                foreach (QRect r, scrollExposure.rects())
+                    rectMergeToList(exposed,pixmapToItem.mapRect(r).adjusted(-1, -1, 1, 1));
 
-            // Render the exposed areas.
-            _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(),
-                              &styleOptionTmp, painterStateProtection);
+                // Now render all rects
+                for (int i = 0; i < exposed.size(); ++i) {
+                    styleOptionTmp = *option;
+                    styleOptionTmp.exposedRect = br.adjusted(-1, -1, 1, 1);
+
+                    // Render the exposed areas.
+                    _q_paintIntoCache(&pix, item, pixmapExposed, itemToPixmap, painter->renderHints(),
+                                      &styleOptionTmp, painterStateProtection);
+                }
+            }
 
             // Reset expose data.
             pixModified = true;
diff -r -u -N /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/rect_merge_util.cpp ./rect_merge_util.cpp
--- /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/rect_merge_util.cpp	1969-12-31 19:00:00.000000000 -0500
+++ ./rect_merge_util.cpp	2010-05-05 19:13:42.000000000 -0400
@@ -0,0 +1,193 @@
+#include "rect_merge_util.h"
+
+template <typename DTYPE,class RECT>
+DTYPE rectArea(const RECT& r)
+{
+    return r.width() * r.height();
+}
+
+template <typename DTYPE,class RECT>
+bool t_rectWeightedJoin(const RECT& rect1,RECT& rect2, qreal areaRatio)
+{
+   RECT joinedRect = rect1 | rect2;
+   DTYPE origArea = rectArea<DTYPE,RECT>(rect1) + rectArea<DTYPE,RECT>(rect2);
+   DTYPE joinedArea = rectArea<DTYPE,RECT>(joinedRect);
+   if(joinedArea > 0 && ((qreal)joinedArea - (qreal)origArea) / (qreal)joinedArea < areaRatio) {
+       rect2 = joinedRect;
+       return true;
+   }
+   return false;
+}
+
+template <typename DTYPE,class RECT>
+DTYPE rectBottom(const RECT& r)
+{
+    return r.top() + r.height();
+}
+
+template <typename DTYPE,class RECT>
+void rectSetBottom(RECT& r,DTYPE pos)
+{
+    r.setHeight(pos - r.top());
+}
+
+template <typename DTYPE,class RECT>
+DTYPE rectRight(const RECT& r)
+{
+    return r.left() + r.width();
+}
+
+template <typename DTYPE,class RECT>
+void rectSetRight(RECT& r,DTYPE pos)
+{
+    r.setWidth(pos - r.left());
+}
+
+template <typename DTYPE,class RECT>
+bool t_rectIntersectedJoin(RECT& rect1, RECT& rect2)
+{
+    RECT intersection = rect1 & rect2;
+
+    if(intersection.isEmpty()) return false;
+
+    RECT bounds = rect1 | rect2;
+    RECT coveredR;
+    RECT cutR;
+    DTYPE areaR;
+    RECT coveredT;
+    RECT cutT;
+    DTYPE areaT;
+
+    // horizontal top
+    DTYPE rb1 = rectBottom<DTYPE,RECT>(rect1);
+    DTYPE rb2 = rectBottom<DTYPE,RECT>(rect2);
+    if(rb1 > rb2) {
+        cutT = rect1;
+    } else {
+        cutT = rect2;
+    }
+    coveredT = bounds;
+    rectSetBottom(coveredT,rectBottom<DTYPE,RECT>(intersection));
+    cutT.setTop(rectBottom<DTYPE,RECT>(intersection));
+    areaT = rectArea<DTYPE,RECT>(coveredT) + rectArea<DTYPE,RECT>(cutT);
+    areaR = areaT;
+    coveredR = coveredT;
+    cutR = cutT;
+
+    // horizontal bottom
+    if(rect1.top() < rect2.top()) {
+        cutT = rect1;
+    } else {
+        cutT = rect2;
+    }
+    coveredT = bounds;
+    coveredT.setTop(intersection.top());
+    rectSetBottom(cutT,intersection.top());
+    areaT = rectArea<DTYPE,RECT>(coveredT) + rectArea<DTYPE,RECT>(cutT);
+    if(areaR > areaT) {
+        areaR = areaT;
+        coveredR = coveredT;
+        cutR = cutT;
+    }
+
+    // vertical left
+    if(rectRight<DTYPE,RECT>(rect1) > rectRight<DTYPE,RECT>(rect2)) {
+        cutT = rect1;
+    } else {
+        cutT = rect2;
+    }
+    coveredT = bounds;
+    rectSetRight(coveredT,rectRight<DTYPE,RECT>(intersection));
+    cutT.setLeft(rectRight<DTYPE,RECT>(intersection));
+    areaT = rectArea<DTYPE,RECT>(coveredT) + rectArea<DTYPE,RECT>(cutT);
+    if(areaR > areaT) {
+        areaR = areaT;
+        coveredR = coveredT;
+        cutR = cutT;
+    }
+
+    // vertical right
+    if(rect1.left() < rect2.left()) {
+        cutT = rect1;
+    } else {
+        cutT = rect2;
+    }
+    coveredT = bounds;
+    coveredT.setLeft(intersection.left());
+    rectSetRight(cutT,intersection.left());
+    areaT = rectArea<DTYPE,RECT>(coveredT) + rectArea<DTYPE,RECT>(cutT);
+    if(areaR > areaT) {
+        areaR = areaT;
+        coveredR = coveredT;
+        cutR = cutT;
+    }
+
+    rect1 = coveredR;
+    rect2 = cutR;
+
+    return true;
+}
+
+template <typename DTYPE,class RECT>
+void t_rectMergeToList(QVector<RECT>& lst, const RECT& rect, qreal areaRatio)
+{
+    QVector<RECT> queue;
+    queue.append(rect);
+
+    while(!queue.empty()) {
+        bool combined = false;
+        int i;
+        for(i = 0; i < lst.size(); i++ ) {
+            if(rectWeightedJoin(lst[i],queue[0],areaRatio)) {
+                combined = true;
+                lst.remove(i,1);
+                break;
+            }
+        }
+        if(combined) continue;
+
+        for(i = 0; i < lst.size(); i++) {
+            if(rectIntersectedJoin(lst[i],queue[0])) {
+                combined = true;
+                queue.append(lst[i]);
+                lst.remove(i,1);
+                break;
+            }
+        }
+        if(combined) continue;
+
+        lst.append(queue[0]);
+        queue.remove(0,1);
+    }
+}
+
+
+bool rectWeightedJoin(const QRect& rect1,QRect& rect2, qreal areaRatio)
+{
+    return t_rectWeightedJoin<int,QRect>(rect1,rect2,areaRatio);
+}
+
+bool rectIntersectedJoin(QRect& rect1, QRect& rect2)
+{
+    return t_rectIntersectedJoin<int,QRect>(rect1,rect2);
+}
+
+void rectMergeToList(QVector<QRect>& lst, const QRect& rect, qreal areaRatio)
+{
+    t_rectMergeToList<int,QRect>(lst,rect,areaRatio);
+}
+
+bool rectWeightedJoin(const QRectF& rect1, QRectF& rect2, qreal areaRatio)
+{
+    return t_rectWeightedJoin<qreal,QRectF>(rect1,rect2,areaRatio);
+}
+
+bool rectIntersectedJoin(QRectF& rect1, QRectF& rect2)
+{
+    return t_rectIntersectedJoin<qreal,QRectF>(rect1,rect2);
+}
+
+void rectMergeToList(QVector<QRectF>& lst, const QRectF& rect, qreal areaRatio)
+{
+    t_rectMergeToList<qreal,QRectF>(lst,rect,areaRatio);
+}
diff -r -u -N /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/rect_merge_util.h ./rect_merge_util.h
--- /usr/local/Trolltech/qt-everywhere-opensource-src-4.6.2/src/gui/graphicsview/rect_merge_util.h	1969-12-31 19:00:00.000000000 -0500
+++ ./rect_merge_util.h	2010-05-05 19:12:54.000000000 -0400
@@ -0,0 +1,17 @@
+#ifndef RECT_MERGE_UTIL_CPP
+#define RECT_MERGE_UTIL_CPP
+
+#include <QRectF>
+#include <QVector>
+
+bool rectWeightedJoin(const QRect& rect1,QRect& rect2, qreal areaRatio = 0.5);
+bool rectIntersectedJoin(QRect& rect1, QRect& rect2);
+void rectMergeToList(QVector<QRect>& lst, const QRect& rect, qreal areaRatio = 0.5);
+
+bool rectWeightedJoin(const QRectF& rect1,QRectF& rect2, qreal areaRatio = 0.5);
+bool rectIntersectedJoin(QRectF& rect1, QRectF& rect2);
+void rectMergeToList(QVector<QRectF>& lst, const QRectF& rect, qreal areaRatio = 0.5);
+
+#endif // RECT_MERGE_UTIL_CPP
+
+
