diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-08-20 14:09:47 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-08-20 14:09:47 (GMT) |
commit | 181c9774791b6f581598389337f9af0fa4658e6a (patch) | |
tree | c38bf4d927a1d4829e65a172e36a4101a2b577f0 | |
parent | 5c7c4b9a0c95f5e97d73547e830a4e4bf87d2fca (diff) | |
download | Qt-181c9774791b6f581598389337f9af0fa4658e6a.zip Qt-181c9774791b6f581598389337f9af0fa4658e6a.tar.gz Qt-181c9774791b6f581598389337f9af0fa4658e6a.tar.bz2 |
Make QGraphicsItem::effectiveBoundingRect/sceneEffectiveBoundingRect internal.
These shouldn't be in public API unless someone ask for it. The same
information is accessible via public functions in QGraphicsEffect and
QGraphicsEffectSource, so they are only convenience functions after all.
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 16 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.h | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene_p.h | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp | 4 |
5 files changed, 14 insertions, 12 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b9b4180..5fa1748 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2284,6 +2284,7 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect) } /*! + \internal \since 4.6 Returns the effective bounding rect of the item. If the item has no effect, this is the same as the item's bounding rect. @@ -2292,14 +2293,14 @@ void QGraphicsItem::setGraphicsEffect(QGraphicsEffect *effect) \sa boundingRect() */ -QRectF QGraphicsItem::effectiveBoundingRect() const +QRectF QGraphicsItemPrivate::effectiveBoundingRect() const { - QGraphicsEffect *effect = d_ptr->graphicsEffect; - QRectF brect = effect && effect->isEnabled() ? effect->boundingRect() : boundingRect(); - if (d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) + QGraphicsEffect *effect = graphicsEffect; + QRectF brect = effect && effect->isEnabled() ? effect->boundingRect() : q_ptr->boundingRect(); + if (ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) return brect; - const QGraphicsItem *effectParent = d_ptr->parent; + const QGraphicsItem *effectParent = parent; while (effectParent) { effect = effectParent->d_ptr->graphicsEffect; if (effect && effect->isEnabled()) @@ -2313,6 +2314,7 @@ QRectF QGraphicsItem::effectiveBoundingRect() const } /*! + \internal \since 4.6 Returns the effective bounding rect of this item in scene coordinates, by combining sceneTransform() with boundingRect(), taking into account @@ -2322,12 +2324,12 @@ QRectF QGraphicsItem::effectiveBoundingRect() const \sa effectiveBoundingRect(), sceneBoundingRect() */ -QRectF QGraphicsItem::sceneEffectiveBoundingRect() const +QRectF QGraphicsItemPrivate::sceneEffectiveBoundingRect() const { // Find translate-only offset // COMBINE QPointF offset; - const QGraphicsItem *parentItem = this; + const QGraphicsItem *parentItem = q_ptr; const QGraphicsItemPrivate *itemd; do { itemd = parentItem->d_ptr; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index b4c7ed8..216053d 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -213,8 +213,6 @@ public: // Effect QGraphicsEffect *graphicsEffect() const; void setGraphicsEffect(QGraphicsEffect *effect); - QRectF effectiveBoundingRect() const; - QRectF sceneEffectiveBoundingRect() const; Qt::MouseButtons acceptedMouseButtons() const; void setAcceptedMouseButtons(Qt::MouseButtons buttons); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index a7b48fc..a798a3b 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -222,6 +222,8 @@ public: void childrenBoundingRectHelper(QTransform *x, QRectF *rect); void initStyleOption(QStyleOptionGraphicsItem *option, const QTransform &worldTransform, const QRegion &exposedRegion, bool allItems = false) const; + QRectF effectiveBoundingRect() const; + QRectF sceneEffectiveBoundingRect() const; virtual void resolveFont(uint inheritedMask) { diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index a405f31..119d9de 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -298,7 +298,7 @@ static inline QRectF adjustedItemBoundingRect(const QGraphicsItem *item) static inline QRectF adjustedItemEffectiveBoundingRect(const QGraphicsItem *item) { Q_ASSERT(item); - QRectF boundingRect(item->effectiveBoundingRect()); + QRectF boundingRect(QGraphicsItemPrivate::get(item)->effectiveBoundingRect()); _q_adjustRect(&boundingRect); return boundingRect; } diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 2d2ce02..1f5d106 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -172,7 +172,7 @@ void QGraphicsSceneBspTreeIndexPrivate::_q_updateIndex() if (item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) continue; - bsp.insertItem(item, item->sceneEffectiveBoundingRect()); + bsp.insertItem(item, item->d_ptr->sceneEffectiveBoundingRect()); } } unindexedItems.clear(); @@ -352,7 +352,7 @@ void QGraphicsSceneBspTreeIndexPrivate::removeItem(QGraphicsItem *item, bool rec purgePending = true; removedItems << item; } else if (!(item->d_ptr->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren)) { - bsp.removeItem(item, item->sceneEffectiveBoundingRect()); + bsp.removeItem(item, item->d_ptr->sceneEffectiveBoundingRect()); } } else { unindexedItems.removeOne(item); |