diff options
-rw-r--r-- | src/gui/graphicsview/qgraphicseffect.cpp | 4 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicseffect.h | 1 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 6 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 4 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene_p.h | 4 |
5 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/graphicsview/qgraphicseffect.cpp b/src/gui/graphicsview/qgraphicseffect.cpp index 6025537..9196ee0 100644 --- a/src/gui/graphicsview/qgraphicseffect.cpp +++ b/src/gui/graphicsview/qgraphicseffect.cpp @@ -204,8 +204,8 @@ void QGraphicsEffect::updateBoundingRect() d->source->update(); } -void QGraphicsEffect::sourceChanged(QGraphicsEffectSource *) -{} +void QGraphicsEffect::sourceChanged(QGraphicsEffectSource *) {} +void QGraphicsEffect::sourceBoundingRectChanged() {} QGraphicsGrayscaleEffect::QGraphicsGrayscaleEffect() : QGraphicsEffect(*new QGraphicsGrayscaleEffectPrivate) diff --git a/src/gui/graphicsview/qgraphicseffect.h b/src/gui/graphicsview/qgraphicseffect.h index 929ea19..37b6d23 100644 --- a/src/gui/graphicsview/qgraphicseffect.h +++ b/src/gui/graphicsview/qgraphicseffect.h @@ -117,6 +117,7 @@ protected: QGraphicsEffect(QGraphicsEffectPrivate &d); virtual void draw(QPainter *painter, QGraphicsEffectSource *source) = 0; virtual void sourceChanged(QGraphicsEffectSource *newSource); + virtual void sourceBoundingRectChanged(); void updateBoundingRect(); private: diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 976ffa3..9700965 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -6661,6 +6661,7 @@ void QGraphicsItem::prepareGeometryChange() d_ptr->scene->d_func()->dirtyGrowingItemsBoundingRect = true; d_ptr->geometryChanged = 1; d_ptr->paintedViewBoundingRectsNeedRepaint = 1; + d_ptr->notifyBoundingRectChanged = !d_ptr->inSetPosHelper; QGraphicsScenePrivate *scenePrivate = d_ptr->scene->d_func(); scenePrivate->index->prepareBoundingRectChange(this); @@ -6684,8 +6685,11 @@ void QGraphicsItem::prepareGeometryChange() } QGraphicsItem *parent = this; - while ((parent = parent->d_ptr->parent)) + while ((parent = parent->d_ptr->parent)) { parent->d_ptr->dirtyChildrenBoundingRect = 1; + // ### Only do this if the parent's effect applies to the entire subtree. + parent->d_ptr->notifyBoundingRectChanged = 1; + } if (d_ptr->inSetPosHelper) return; diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 8b7f5b5..c01ee1a 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -164,6 +164,7 @@ public: acceptedTouchBeginEvent(0), filtersDescendantEvents(0), sceneTransformTranslateOnly(0), + notifyBoundingRectChanged(0), globalStackingOrder(-1), q_ptr(0) { @@ -457,7 +458,8 @@ public: quint32 acceptedTouchBeginEvent : 1; quint32 filtersDescendantEvents : 1; quint32 sceneTransformTranslateOnly : 1; - quint32 unused : 6; // feel free to use + quint32 notifyBoundingRectChanged : 1; + quint32 unused : 5; // feel free to use // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 56e6224..6223101 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -227,10 +227,14 @@ public: item->d_ptr->fullUpdatePending = 0; item->d_ptr->ignoreVisible = 0; item->d_ptr->ignoreOpacity = 0; + const bool notifyEffect = item->d_ptr->notifyBoundingRectChanged; + item->d_ptr->notifyBoundingRectChanged = 0; if (recursive) { for (int i = 0; i < item->d_ptr->children.size(); ++i) resetDirtyItem(item->d_ptr->children.at(i), recursive); } + if (notifyEffect && item->d_ptr->graphicsEffect) + item->d_ptr->graphicsEffect->sourceBoundingRectChanged(); } inline void ensureSortedTopLevelItems() |