diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-11-04 10:18:40 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-11-04 10:20:19 (GMT) |
commit | 2747f200ce27599af74f01cb629ec8930bae7b44 (patch) | |
tree | a9cad30179f38581d4d43bfafeab2d62122b269d | |
parent | e22581675866cbf88e948eae2e83eb13a43a2d44 (diff) | |
download | Qt-2747f200ce27599af74f01cb629ec8930bae7b44.zip Qt-2747f200ce27599af74f01cb629ec8930bae7b44.tar.gz Qt-2747f200ce27599af74f01cb629ec8930bae7b44.tar.bz2 |
Provide hook that's called when items' stacking order is changed.
This is required by the QtDeclarative module. As an isolated change,
this is just a noop. It takes effect when somebody reimpements the
private virtual function.
Reviewed-by: Alan Alpert
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 16 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index e69a295..e014763 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -4345,6 +4345,12 @@ void QGraphicsItem::stackBefore(const QGraphicsItem *sibling) ++index; } d_ptr->siblingIndex = siblingIndex; + for (int i = 0; i < siblings->size(); ++i) { + int &index = siblings->at(i)->d_ptr->siblingIndex; + if (i != siblingIndex && index >= siblingIndex && index <= myIndex) + siblings->at(i)->d_ptr->siblingOrderChange(); + } + d_ptr->siblingOrderChange(); } } @@ -5342,6 +5348,16 @@ void QGraphicsItemPrivate::subFocusItemChange() /*! \internal + Subclasses can reimplement this function to be notified when its + siblingIndex order is changed. +*/ +void QGraphicsItemPrivate::siblingOrderChange() +{ +} + +/*! + \internal + Tells us if it is a proxy widget */ bool QGraphicsItemPrivate::isProxyWidget() const diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 92d45f6..977fa96 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -431,6 +431,7 @@ public: static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b); void ensureSequentialSiblingIndex(); inline void sendScenePosChange(); + virtual void siblingOrderChange(); QPainterPath cachedClipPath; QRectF childrenBoundingRect; |