diff options
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 6 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.h | 3 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicslayoutitem.cpp | 1 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicslayoutitem.h | 3 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsproxywidget.h | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 10 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicssceneevent.cpp | 1 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicssceneevent.h | 3 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget.cpp | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget.h | 2 |
11 files changed, 17 insertions, 18 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index ed1891c..596326b 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -875,8 +875,6 @@ QGraphicsItem::~QGraphicsItem() if (d_ptr->scene) d_ptr->scene->d_func()->_q_removeItemLater(this); - delete d_ptr; - qt_dataStore()->data.remove(this); } @@ -2732,7 +2730,7 @@ QTransform QGraphicsItem::itemTransform(const QGraphicsItem *other, bool *ok) co QTransform x; const QGraphicsItem *p = child; do { - const QGraphicsItemPrivate *pd = p->d_ptr; + const QGraphicsItemPrivate *pd = p->d_ptr.data(); if (pd->hasTransform) x *= p->transform(); if (!pd->pos.isNull()) @@ -3070,7 +3068,7 @@ QRectF QGraphicsItem::sceneBoundingRect() const const QGraphicsItem *parentItem = this; const QGraphicsItemPrivate *itemd; do { - itemd = parentItem->d_ptr; + itemd = parentItem->d_ptr.data(); if (itemd->hasTransform) break; offset += itemd->pos; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index b98882d..25678a6 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -46,6 +46,7 @@ #include <QtCore/qobject.h> #include <QtCore/qvariant.h> #include <QtCore/qrect.h> +#include <QtCore/qscopedpointer.h> #include <QtGui/qpainterpath.h> #include <QtGui/qpixmap.h> @@ -380,7 +381,7 @@ protected: protected: QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); - QGraphicsItemPrivate *d_ptr; + QScopedPointer<QGraphicsItemPrivate> d_ptr; void addToIndex(); void removeFromIndex(); diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index b46e05e..c291763 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -307,7 +307,6 @@ QGraphicsLayoutItem::~QGraphicsLayoutItem() } } } - delete d_ptr; } /*! diff --git a/src/gui/graphicsview/qgraphicslayoutitem.h b/src/gui/graphicsview/qgraphicslayoutitem.h index 31f5d90..d667c4f 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.h +++ b/src/gui/graphicsview/qgraphicslayoutitem.h @@ -42,6 +42,7 @@ #ifndef QGRAPHICSLAYOUTITEM_H #define QGRAPHICSLAYOUTITEM_H +#include <QtCore/qscopedpointer.h> #include <QtGui/qsizepolicy.h> #include <QtGui/qevent.h> @@ -112,7 +113,7 @@ protected: QGraphicsLayoutItem(QGraphicsLayoutItemPrivate &dd); virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const = 0; - QGraphicsLayoutItemPrivate *d_ptr; + QScopedPointer<QGraphicsLayoutItemPrivate> d_ptr; private: QSizeF *effectiveSizeHints(const QSizeF &constraint) const; diff --git a/src/gui/graphicsview/qgraphicsproxywidget.h b/src/gui/graphicsview/qgraphicsproxywidget.h index b2c3c8f..f006319 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.h +++ b/src/gui/graphicsview/qgraphicsproxywidget.h @@ -127,7 +127,7 @@ protected Q_SLOTS: private: Q_DISABLE_COPY(QGraphicsProxyWidget) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QGraphicsProxyWidget) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsProxyWidget) Q_PRIVATE_SLOT(d_func(), void _q_removeWidgetSlot()) friend class QWidget; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index b89e352..5114351 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1824,8 +1824,8 @@ void QGraphicsScenePrivate::invalidateSortCache() inline bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2) { // Return true if sibling item1 is on top of item2. - const QGraphicsItemPrivate *d1 = item1->d_ptr; - const QGraphicsItemPrivate *d2 = item2->d_ptr; + const QGraphicsItemPrivate *d1 = item1->d_ptr.data(); + const QGraphicsItemPrivate *d2 = item2->d_ptr.data(); bool f1 = d1->flags & QGraphicsItem::ItemStacksBehindParent; bool f2 = d2->flags & QGraphicsItem::ItemStacksBehindParent; if (f1 != f2) return f2; @@ -1852,8 +1852,8 @@ inline bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem bool QGraphicsScenePrivate::closestItemFirst_withoutCache(const QGraphicsItem *item1, const QGraphicsItem *item2) { // Siblings? Just check their z-values. - const QGraphicsItemPrivate *d1 = item1->d_ptr; - const QGraphicsItemPrivate *d2 = item2->d_ptr; + const QGraphicsItemPrivate *d1 = item1->d_ptr.data(); + const QGraphicsItemPrivate *d2 = item2->d_ptr.data(); if (d1->parent == d2->parent) return qt_closestLeaf(item1, item2); @@ -4687,7 +4687,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte const QStyleOptionGraphicsItem *option, QWidget *widget, bool painterStateProtection) { - QGraphicsItemPrivate *itemd = item->d_ptr; + QGraphicsItemPrivate *itemd = item->d_ptr.data(); QGraphicsItem::CacheMode cacheMode = QGraphicsItem::CacheMode(itemd->cacheMode); // Render directly, using no cache. diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index 0ffd2b1..ad57aac 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -313,7 +313,6 @@ QGraphicsSceneEvent::QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type ty */ QGraphicsSceneEvent::~QGraphicsSceneEvent() { - delete d_ptr; } /*! diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h index be50e96..4ebe3df 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/gui/graphicsview/qgraphicssceneevent.h @@ -44,6 +44,7 @@ #include <QtCore/qcoreevent.h> #include <QtCore/qpoint.h> +#include <QtCore/qscopedpointer.h> QT_BEGIN_HEADER @@ -70,7 +71,7 @@ public: protected: QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None); - QGraphicsSceneEventPrivate *d_ptr; + QScopedPointer<QGraphicsSceneEventPrivate> d_ptr; Q_DECLARE_PRIVATE(QGraphicsSceneEvent) }; diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 8137f8e..96e9a96 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -753,7 +753,7 @@ QRect QGraphicsViewPrivate::mapToViewRect(const QGraphicsItem *item, const QRect const QGraphicsItem *parentItem = item; const QGraphicsItemPrivate *itemd; do { - itemd = parentItem->d_ptr; + itemd = parentItem->d_ptr.data(); if (itemd->hasTransform) break; offset += itemd->pos; diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 7781258..aa2b9bf 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -366,7 +366,7 @@ void QGraphicsWidget::resize(const QSizeF &size) void QGraphicsWidget::setGeometry(const QRectF &rect) { QGraphicsWidgetPrivate *wd = QGraphicsWidget::d_func(); - QGraphicsLayoutItemPrivate *d = QGraphicsLayoutItem::d_ptr; + QGraphicsLayoutItemPrivate *d = QGraphicsLayoutItem::d_ptr.data(); QRectF newGeom; QPointF oldPos = d->geom.topLeft(); if (!wd->inSetPos) { diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 34f1c5f..49de542 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -225,7 +225,7 @@ protected: private: Q_DISABLE_COPY(QGraphicsWidget) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QGraphicsWidget) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsWidget) friend class QGraphicsScene; friend class QGraphicsScenePrivate; friend class QGraphicsView; |