summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2009-09-22 09:31:28 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-09-22 09:31:28 (GMT)
commit2e7554495046477dc5e8ba34fd63146a3c9bd5c3 (patch)
tree319e8a5926b084ae125dd0e56064f1c7c3302998
parent1e807fb6b9cc2efa0979ed4cdbf20e89f1d467d0 (diff)
parentd14fd301314bcceaf2594a5a18f6d20894c1d353 (diff)
downloadQt-2e7554495046477dc5e8ba34fd63146a3c9bd5c3.zip
Qt-2e7554495046477dc5e8ba34fd63146a3c9bd5c3.tar.gz
Qt-2e7554495046477dc5e8ba34fd63146a3c9bd5c3.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp6
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp32
-rw-r--r--tests/auto/windowsmobile/test/tst_windowsmobile.cpp2
3 files changed, 37 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 2ee03e4..5799fe7 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -5742,10 +5742,12 @@ void QGraphicsItem::prepareGeometryChange()
if (d_ptr->inSetPosHelper)
return;
- if (d_ptr->flags & ItemClipsChildrenToShape)
+ if (d_ptr->flags & ItemClipsChildrenToShape
+ || d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) {
d_ptr->invalidateCachedClipPathRecursively();
- else
+ } else {
d_ptr->invalidateCachedClipPath();
+ }
}
/*!
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index d6605db..391ccf8 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -194,6 +194,7 @@ private slots:
void itemClipsToShape();
void itemClipsChildrenToShape();
void itemClipsChildrenToShape2();
+ void itemClipsChildrenToShape3();
void itemClipsTextChildToShape();
void itemClippingDiscovery();
void ancestorFlags();
@@ -4691,6 +4692,37 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2()
#endif
}
+void tst_QGraphicsItem::itemClipsChildrenToShape3()
+{
+ // Construct a scene with nested children, each 50 pixels offset from the elder.
+ // Set a top-level clipping flag
+ QGraphicsScene scene;
+ QGraphicsRectItem *parent = scene.addRect( 0, 0, 150, 150 );
+ QGraphicsRectItem *child = scene.addRect( 0, 0, 150, 150 );
+ QGraphicsRectItem *grandchild = scene.addRect( 0, 0, 150, 150 );
+ child->setParentItem(parent);
+ grandchild->setParentItem(child);
+ child->setPos( 50, 50 );
+ grandchild->setPos( 50, 50 );
+ parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
+
+ QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)parent);
+ QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)child);
+ QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0);
+
+ // Move child to fully overlap the parent. The grandchild should
+ // now occupy two-thirds of the scene
+ child->prepareGeometryChange();
+ child->setPos( 0, 0 );
+
+ QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)child);
+ QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0);
+}
+
+
void tst_QGraphicsItem::itemClipsTextChildToShape()
{
// Construct a scene with a rect that clips its children, with one text
diff --git a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
index 533d98f..a49e9a6 100644
--- a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
+++ b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
@@ -45,7 +45,7 @@
#include <QtCore/QObject>
#include <QtGui>
#include <windows.h>
-#include <ddhelper.h>
+#include "ddhelper.h"