summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-04 15:07:58 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-09 07:33:44 (GMT)
commit9eb253eed0ae75d1d32b5e738ead89434fc69837 (patch)
tree4b051c8dbd15900a76798c7b48dac14a9aabacc8 /src
parent32c00c1d30eb275f44ba9d0bff4d6b6b05e9a5ba (diff)
downloadQt-9eb253eed0ae75d1d32b5e738ead89434fc69837.zip
Qt-9eb253eed0ae75d1d32b5e738ead89434fc69837.tar.gz
Qt-9eb253eed0ae75d1d32b5e738ead89434fc69837.tar.bz2
Fix stacking order bug, ensure the dirty sort bits are set correctly.
The code marked the item's own stacking order as dirty when changing its own Z value, the right thing is however to set the _parent's_ bit. Also added missing code for when the ItemStacksBehindParent flag was toggled. Reviewed-by: bnilsen
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 2eb5150..47a9ae2 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1442,6 +1442,14 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
d_ptr->updateAncestorFlag(ItemIgnoresTransformations);
}
+ if ((flags & ItemStacksBehindParent) != (oldFlags & ItemStacksBehindParent)) {
+ // Ensure child item sorting is up to date when toggling this flag.
+ if (d_ptr->parent)
+ d_ptr->parent->d_ptr->needSortChildren = 1;
+ else if (d_ptr->scene)
+ d_ptr->scene->d_func()->needSortTopLevelItems = 1;
+ }
+
if (d_ptr->scene) {
d_ptr->scene->d_func()->markDirty(this, QRectF(),
/*invalidateChildren=*/true,
@@ -3230,7 +3238,10 @@ void QGraphicsItem::setZValue(qreal z)
return;
}
d_ptr->z = newZ;
- d_ptr->needSortChildren = 1;
+ if (d_ptr->parent)
+ d_ptr->parent->d_ptr->needSortChildren = 1;
+ else if (d_ptr->scene)
+ d_ptr->scene->d_func()->needSortTopLevelItems = 1;
if (d_ptr->scene) {
d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true);