summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-10 16:14:48 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-10 16:45:36 (GMT)
commit435fae071798817f57bc89bf5d1ac20aae488625 (patch)
treeb89688c7fac9790cb678879bdf7d357b7c761b67 /src/gui/graphicsview
parent3384aea1357a0f2e7c633701f467d5f8b0855c50 (diff)
downloadQt-435fae071798817f57bc89bf5d1ac20aae488625.zip
Qt-435fae071798817f57bc89bf5d1ac20aae488625.tar.gz
Qt-435fae071798817f57bc89bf5d1ac20aae488625.tar.bz2
QGraphicsItem not updated properly when moving parent.
Found during manual testing (manualtests/graphicsview/movableitems). Moving a child item (via its parent) outside the viewport, and then back again didn't trigger an update on the child. Reason was that we had a cut-off checking the wrong bit (geometryChanged). This bit means exactly the same as the paintedViewBoundingRectsNeedRepaint bit, except that it doesn't propagate to the children (and that's the bug). We use paintedViewBoundingRectsNeedRepaint instead. Auto-test included.
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp1
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 0cfaab7..b7385d4 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1822,6 +1822,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
q_ptr->setSelected(false);
} else {
geometryChanged = 1;
+ paintedViewBoundingRectsNeedRepaint = 1;
if (isWidget && scene) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr);
if (widget->windowType() == Qt::Popup)
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index c7c0865..aa7fa4c 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4568,7 +4568,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
if (!item->d_ptr->dirty)
continue;
- if (!item->d_ptr->geometryChanged
+ if (!item->d_ptr->paintedViewBoundingRectsNeedRepaint
&& paintedViewBoundingRect.x() == -1 && paintedViewBoundingRect.y() == -1
&& paintedViewBoundingRect.width() == -1 && paintedViewBoundingRect.height() == -1) {
continue; // Outside viewport.
@@ -4587,7 +4587,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
continue; // Discard updates outside the bounding rect.
if (!updateHelper(viewPrivate, item->d_ptr, dirtyRect, itemIsUntransformable)
- && item->d_ptr->geometryChanged) {
+ && item->d_ptr->paintedViewBoundingRectsNeedRepaint) {
paintedViewBoundingRect = QRect(-1, -1, -1, -1); // Outside viewport.
}
}