summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 6d75db3..37d969b 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -328,6 +328,10 @@
used for Asian languages.
This flag was introduced in Qt 4.6.
+ \value ItemNegativeZStacksBehindParent The item automatically stacks behind
+ it's parent if it's z-value is negative. This flag enables setZValue() to
+ toggle ItemStacksBehindParent.
+
\value ItemAutoDetectsFocusProxy The item will assign any child that
gains input focus as its focus proxy. See also focusProxy().
This flag was introduced in Qt 4.6.
@@ -1566,6 +1570,11 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
d_ptr->scene->d_func()->updateInputMethodSensitivityInViews();
}
+ if ((flags & ItemNegativeZStacksBehindParent) != (oldFlags & ItemNegativeZStacksBehindParent)) {
+ // Update stack-behind.
+ setFlag(ItemStacksBehindParent, d_ptr->z < qreal(0.0));
+ }
+
if (d_ptr->scene) {
d_ptr->scene->d_func()->markDirty(this, QRectF(),
/*invalidateChildren=*/true,
@@ -3719,6 +3728,9 @@ void QGraphicsItem::setZValue(qreal z)
itemChange(ItemZValueHasChanged, newZVariant);
+ if (d_ptr->flags & ItemNegativeZStacksBehindParent)
+ setFlag(QGraphicsItem::ItemStacksBehindParent, z < qreal(0.0));
+
if (d_ptr->isObject)
emit static_cast<QGraphicsObject *>(this)->zChanged();
}
@@ -10103,6 +10115,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag)
case QGraphicsItem::ItemAcceptsInputMethod:
str = "ItemAcceptsInputMethod";
break;
+ case QGraphicsItem::ItemNegativeZStacksBehindParent:
+ str = "ItemNegativeZStacksBehindParent";
+ break;
case QGraphicsItem::ItemAutoDetectsFocusProxy:
str = "ItemAutoDetectsFocusProxy";
break;