Remove the obsolete scene argument for constructors of graphics items

The argument has been obsoleted and not documented since 2007. Get rid
of it now before Qt 5.0

Task-number: QTBUG-25089
Change-Id: I91a5508a5e1606f5b5c289501295c67be4abe6a0
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
Lars Knoll 2012-07-30 23:36:59 +02:00 committed by Qt by Nokia
parent 8632b26285
commit 328550ff00
18 changed files with 110 additions and 348 deletions

4
dist/changes-5.0.0 vendored
View File

@ -459,6 +459,10 @@ QtWidgets
those classes are now QDate and QTime respectively, not QDateTime as they have been those classes are now QDate and QTime respectively, not QDateTime as they have been
for the 4.7 and 4.8 releases. for the 4.7 and 4.8 releases.
* QGraphicsItem and derived classes - Passing a QGraphicsScene in the items constructor
is no longer supported. Construct the item without a scene and then call
QGraphicsScene::addItem() to add the item to the scene.
QtNetwork QtNetwork
--------- ---------
* QHostAddress::isLoopback() API added. Returns true if the address is * QHostAddress::isLoopback() API added. Returns true if the address is

View File

@ -46,9 +46,8 @@
const qreal Pi = 3.14; const qreal Pi = 3.14;
//! [0] //! [0]
Arrow::Arrow(DiagramItem *startItem, DiagramItem *endItem, Arrow::Arrow(DiagramItem *startItem, DiagramItem *endItem, QGraphicsItem *parent)
QGraphicsItem *parent, QGraphicsScene *scene) : QGraphicsLineItem(parent)
: QGraphicsLineItem(parent, scene)
{ {
myStartItem = startItem; myStartItem = startItem;
myEndItem = endItem; myEndItem = endItem;

View File

@ -61,7 +61,7 @@ public:
enum { Type = UserType + 4 }; enum { Type = UserType + 4 };
Arrow(DiagramItem *startItem, DiagramItem *endItem, Arrow(DiagramItem *startItem, DiagramItem *endItem,
QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); QGraphicsItem *parent = 0);
int type() const int type() const
{ return Type; } { return Type; }

View File

@ -45,8 +45,8 @@
//! [0] //! [0]
DiagramItem::DiagramItem(DiagramType diagramType, QMenu *contextMenu, DiagramItem::DiagramItem(DiagramType diagramType, QMenu *contextMenu,
QGraphicsItem *parent, QGraphicsScene *scene) QGraphicsItem *parent)
: QGraphicsPolygonItem(parent, scene) : QGraphicsPolygonItem(parent)
{ {
myDiagramType = diagramType; myDiagramType = diagramType;
myContextMenu = contextMenu; myContextMenu = contextMenu;

View File

@ -68,7 +68,7 @@ public:
enum DiagramType { Step, Conditional, StartEnd, Io }; enum DiagramType { Step, Conditional, StartEnd, Io };
DiagramItem(DiagramType diagramType, QMenu *contextMenu, DiagramItem(DiagramType diagramType, QMenu *contextMenu,
QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); QGraphicsItem *parent = 0);
void removeArrow(Arrow *arrow); void removeArrow(Arrow *arrow);
void removeArrows(); void removeArrows();

View File

@ -44,8 +44,8 @@
#include "diagramscene.h" #include "diagramscene.h"
//! [0] //! [0]
DiagramTextItem::DiagramTextItem(QGraphicsItem *parent, QGraphicsScene *scene) DiagramTextItem::DiagramTextItem(QGraphicsItem *parent)
: QGraphicsTextItem(parent, scene) : QGraphicsTextItem(parent)
{ {
setFlag(QGraphicsItem::ItemIsMovable); setFlag(QGraphicsItem::ItemIsMovable);
setFlag(QGraphicsItem::ItemIsSelectable); setFlag(QGraphicsItem::ItemIsSelectable);

View File

@ -59,7 +59,7 @@ class DiagramTextItem : public QGraphicsTextItem
public: public:
enum { Type = UserType + 3 }; enum { Type = UserType + 3 };
DiagramTextItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); DiagramTextItem(QGraphicsItem *parent = 0);
int type() const int type() const
{ return Type; } { return Type; }

View File

@ -41,9 +41,8 @@
#include "imageitem.h" #include "imageitem.h"
//! [0] //! [0]
ImageItem::ImageItem(int id, const QPixmap &pixmap, QGraphicsItem *parent, ImageItem::ImageItem(int id, const QPixmap &pixmap, QGraphicsItem *parent)
QGraphicsScene *scene) : QGraphicsPixmapItem(pixmap, parent)
: QGraphicsPixmapItem(pixmap, parent, scene)
{ {
recordId = id; recordId = id;
setAcceptHoverEvents(true); setAcceptHoverEvents(true);

View File

@ -50,8 +50,7 @@ class ImageItem : public QObject, public QGraphicsPixmapItem
Q_OBJECT Q_OBJECT
public: public:
ImageItem(int id, const QPixmap &pixmap, QGraphicsItem *parent = 0, ImageItem(int id, const QPixmap &pixmap, QGraphicsItem *parent = 0);
QGraphicsScene *scene = 0);
void adjust(); void adjust();
int id(); int id();

View File

@ -42,9 +42,8 @@
#include "diagramitem.h" #include "diagramitem.h"
DiagramItem::DiagramItem(DiagramType diagramType, QGraphicsItem *item, DiagramItem::DiagramItem(DiagramType diagramType, QGraphicsItem *item)
QGraphicsScene *scene) : QGraphicsPolygonItem(item)
: QGraphicsPolygonItem(item, scene)
{ {
if (diagramType == Box) { if (diagramType == Box) {
boxPolygon << QPointF(0, 0) << QPointF(0, 30) << QPointF(30, 30) boxPolygon << QPointF(0, 0) << QPointF(0, 30) << QPointF(30, 30)

View File

@ -56,8 +56,7 @@ public:
enum { Type = UserType + 1 }; enum { Type = UserType + 1 };
enum DiagramType { Box, Triangle }; enum DiagramType { Box, Triangle };
DiagramItem(DiagramType diagramType, QGraphicsItem *item = 0, DiagramItem(DiagramType diagramType, QGraphicsItem *item = 0);
QGraphicsScene *scene = 0);
DiagramType diagramType() const { DiagramType diagramType() const {
return polygon() == boxPolygon ? Box : Triangle; return polygon() == boxPolygon ? Box : Triangle;

View File

@ -1377,45 +1377,21 @@ void QGraphicsItemCache::purge()
\sa QGraphicsScene::addItem(), setParentItem() \sa QGraphicsScene::addItem(), setParentItem()
*/ */
QGraphicsItem::QGraphicsItem(QGraphicsItem *parent QGraphicsItem::QGraphicsItem(QGraphicsItem *parent)
#ifndef Q_QDOC
// obsolete argument
, QGraphicsScene *scene
#endif
)
: d_ptr(new QGraphicsItemPrivate) : d_ptr(new QGraphicsItemPrivate)
{ {
d_ptr->q_ptr = this; d_ptr->q_ptr = this;
setParentItem(parent); setParentItem(parent);
if (scene && parent && parent->scene() != scene) {
qWarning("QGraphicsItem::QGraphicsItem: ignoring scene (%p), which is"
" different from parent's scene (%p)",
scene, parent->scene());
return;
}
if (scene && !parent)
scene->addItem(this);
} }
/*! /*!
\internal \internal
*/ */
QGraphicsItem::QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsItem::QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem *parent)
QGraphicsScene *scene)
: d_ptr(&dd) : d_ptr(&dd)
{ {
d_ptr->q_ptr = this; d_ptr->q_ptr = this;
setParentItem(parent); setParentItem(parent);
if (scene && parent && parent->scene() != scene) {
qWarning("QGraphicsItem::QGraphicsItem: ignoring scene (%p), which is"
" different from parent's scene (%p)",
scene, parent->scene());
return;
}
if (scene && !parent)
scene->addItem(this);
} }
/*! /*!
@ -7590,8 +7566,8 @@ QGraphicsObject::QGraphicsObject(QGraphicsItem *parent)
/*! /*!
\internal \internal
*/ */
QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene) QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent)
: QGraphicsItem(dd, parent, scene) : QGraphicsItem(dd, parent)
{ {
QGraphicsItem::d_ptr->isObject = true; QGraphicsItem::d_ptr->isObject = true;
} }
@ -8018,23 +7994,16 @@ public:
Constructs a QAbstractGraphicsShapeItem. \a parent is passed to Constructs a QAbstractGraphicsShapeItem. \a parent is passed to
QGraphicsItem's constructor. QGraphicsItem's constructor.
*/ */
QAbstractGraphicsShapeItem::QAbstractGraphicsShapeItem(QGraphicsItem *parent QAbstractGraphicsShapeItem::QAbstractGraphicsShapeItem(QGraphicsItem *parent)
#ifndef Q_QDOC : QGraphicsItem(*new QAbstractGraphicsShapeItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QGraphicsItem(*new QAbstractGraphicsShapeItemPrivate, parent, scene)
{ {
} }
/*! /*!
\internal \internal
*/ */
QAbstractGraphicsShapeItem::QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd, QAbstractGraphicsShapeItem::QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd, QGraphicsItem *parent)
QGraphicsItem *parent, : QGraphicsItem(dd, parent)
QGraphicsScene *scene)
: QGraphicsItem(dd, parent, scene)
{ {
} }
@ -8161,13 +8130,8 @@ public:
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path, QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path,
QGraphicsItem *parent QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsPathItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsPathItemPrivate, parent, scene)
{ {
if (!path.isEmpty()) if (!path.isEmpty())
setPath(path); setPath(path);
@ -8179,13 +8143,8 @@ QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path,
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsPathItem::QGraphicsPathItem(QGraphicsItem *parent QGraphicsPathItem::QGraphicsPathItem(QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsPathItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsPathItemPrivate, parent, scene)
{ {
} }
@ -8370,13 +8329,8 @@ public:
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsRectItem::QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent QGraphicsRectItem::QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsRectItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsRectItemPrivate, parent, scene)
{ {
setRect(rect); setRect(rect);
} }
@ -8393,13 +8347,8 @@ QGraphicsRectItem::QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsRectItem::QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsRectItem::QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h,
QGraphicsItem *parent QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsRectItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsRectItemPrivate, parent, scene)
{ {
setRect(QRectF(x, y, w, h)); setRect(QRectF(x, y, w, h));
} }
@ -8410,13 +8359,8 @@ QGraphicsRectItem::QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h,
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsRectItem::QGraphicsRectItem(QGraphicsItem *parent QGraphicsRectItem::QGraphicsRectItem(QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsRectItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsRectItemPrivate, parent, scene)
{ {
} }
@ -8621,13 +8565,8 @@ public:
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsEllipseItem::QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent QGraphicsEllipseItem::QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsEllipseItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsEllipseItemPrivate, parent, scene)
{ {
setRect(rect); setRect(rect);
} }
@ -8643,13 +8582,8 @@ QGraphicsEllipseItem::QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *pa
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsEllipseItem::QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsEllipseItem::QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h,
QGraphicsItem *parent QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsEllipseItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsEllipseItemPrivate, parent, scene)
{ {
setRect(x,y,w,h); setRect(x,y,w,h);
} }
@ -8662,13 +8596,8 @@ QGraphicsEllipseItem::QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h,
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsEllipseItem::QGraphicsEllipseItem(QGraphicsItem *parent QGraphicsEllipseItem::QGraphicsEllipseItem(QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsEllipseItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsEllipseItemPrivate, parent, scene)
{ {
} }
@ -8930,14 +8859,8 @@ public:
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsPolygonItem::QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsPolygonItem::QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent)
QGraphicsItem *parent : QAbstractGraphicsShapeItem(*new QGraphicsPolygonItemPrivate, parent)
#ifndef Q_QDOC
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsPolygonItemPrivate, parent, scene)
{ {
setPolygon(polygon); setPolygon(polygon);
} }
@ -8948,13 +8871,8 @@ QGraphicsPolygonItem::QGraphicsPolygonItem(const QPolygonF &polygon,
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsPolygonItem::QGraphicsPolygonItem(QGraphicsItem *parent QGraphicsPolygonItem::QGraphicsPolygonItem(QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsPolygonItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsPolygonItemPrivate, parent, scene)
{ {
} }
@ -9159,13 +9077,8 @@ public:
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsLineItem::QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent QGraphicsLineItem::QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent)
#ifndef Q_QDOC : QGraphicsItem(*new QGraphicsLineItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QGraphicsItem(*new QGraphicsLineItemPrivate, parent, scene)
{ {
setLine(line); setLine(line);
} }
@ -9177,13 +9090,8 @@ QGraphicsLineItem::QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsLineItem::QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent QGraphicsLineItem::QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent)
#ifndef Q_QDOC : QGraphicsItem(*new QGraphicsLineItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QGraphicsItem(*new QGraphicsLineItemPrivate, parent, scene)
{ {
setLine(x1, y1, x2, y2); setLine(x1, y1, x2, y2);
} }
@ -9196,13 +9104,8 @@ QGraphicsLineItem::QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGr
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsLineItem::QGraphicsLineItem(QGraphicsItem *parent QGraphicsLineItem::QGraphicsLineItem(QGraphicsItem *parent)
#ifndef Q_QDOC : QGraphicsItem(*new QGraphicsLineItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QGraphicsItem(*new QGraphicsLineItemPrivate, parent, scene)
{ {
} }
@ -9490,14 +9393,8 @@ public:
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsPixmapItem::QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsPixmapItem::QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent)
QGraphicsItem *parent : QGraphicsItem(*new QGraphicsPixmapItemPrivate, parent)
#ifndef Q_QDOC
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QGraphicsItem(*new QGraphicsPixmapItemPrivate, parent, scene)
{ {
setPixmap(pixmap); setPixmap(pixmap);
} }
@ -9508,13 +9405,8 @@ QGraphicsPixmapItem::QGraphicsPixmapItem(const QPixmap &pixmap,
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsPixmapItem::QGraphicsPixmapItem(QGraphicsItem *parent QGraphicsPixmapItem::QGraphicsPixmapItem(QGraphicsItem *parent)
#ifndef Q_QDOC : QGraphicsItem(*new QGraphicsPixmapItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QGraphicsItem(*new QGraphicsPixmapItemPrivate, parent, scene)
{ {
} }
@ -9826,13 +9718,9 @@ public:
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsTextItem::QGraphicsTextItem(const QString &text, QGraphicsItem *parent QGraphicsTextItem::QGraphicsTextItem(const QString &text, QGraphicsItem *parent)
#ifndef Q_QDOC : QGraphicsObject(*new QGraphicsItemPrivate, parent),
// obsolete argument dd(new QGraphicsTextItemPrivate)
, QGraphicsScene *scene
#endif
)
: QGraphicsObject(*new QGraphicsItemPrivate, parent, scene), dd(new QGraphicsTextItemPrivate)
{ {
dd->qq = this; dd->qq = this;
if (!text.isEmpty()) if (!text.isEmpty())
@ -9848,13 +9736,9 @@ QGraphicsTextItem::QGraphicsTextItem(const QString &text, QGraphicsItem *parent
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsTextItem::QGraphicsTextItem(QGraphicsItem *parent QGraphicsTextItem::QGraphicsTextItem(QGraphicsItem *parent)
#ifndef Q_QDOC : QGraphicsObject(*new QGraphicsItemPrivate, parent),
// obsolete argument dd(new QGraphicsTextItemPrivate)
, QGraphicsScene *scene
#endif
)
: QGraphicsObject(*new QGraphicsItemPrivate, parent, scene), dd(new QGraphicsTextItemPrivate)
{ {
dd->qq = this; dd->qq = this;
setAcceptDrops(true); setAcceptDrops(true);
@ -10710,13 +10594,8 @@ void QGraphicsSimpleTextItemPrivate::updateBoundingRect()
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(QGraphicsItem *parent QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsSimpleTextItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsSimpleTextItemPrivate, parent, scene)
{ {
} }
@ -10727,13 +10606,8 @@ QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(QGraphicsItem *parent
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent)
#ifndef Q_QDOC : QAbstractGraphicsShapeItem(*new QGraphicsSimpleTextItemPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QAbstractGraphicsShapeItem(*new QGraphicsSimpleTextItemPrivate, parent, scene)
{ {
setText(text); setText(text);
} }
@ -10977,13 +10851,8 @@ public:
\sa QGraphicsScene::addItem() \sa QGraphicsScene::addItem()
*/ */
QGraphicsItemGroup::QGraphicsItemGroup(QGraphicsItem *parent QGraphicsItemGroup::QGraphicsItemGroup(QGraphicsItem *parent)
#ifndef Q_QDOC : QGraphicsItem(*new QGraphicsItemGroupPrivate, parent)
// obsolete argument
, QGraphicsScene *scene
#endif
)
: QGraphicsItem(*new QGraphicsItemGroupPrivate, parent, scene)
{ {
setHandlesChildEvents(true); setHandlesChildEvents(true);
} }

View File

@ -162,12 +162,7 @@ public:
SceneModal SceneModal
}; };
QGraphicsItem(QGraphicsItem *parent = 0 QGraphicsItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
virtual ~QGraphicsItem(); virtual ~QGraphicsItem();
QGraphicsScene *scene() const; QGraphicsScene *scene() const;
@ -460,8 +455,7 @@ protected:
virtual QVariant extension(const QVariant &variant) const; virtual QVariant extension(const QVariant &variant) const;
protected: protected:
QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem *parent);
QGraphicsItem *parent, QGraphicsScene *scene);
QScopedPointer<QGraphicsItemPrivate> d_ptr; QScopedPointer<QGraphicsItemPrivate> d_ptr;
void addToIndex(); void addToIndex();
@ -599,7 +593,7 @@ Q_SIGNALS:
void heightChanged(); void heightChanged();
protected: protected:
QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent);
private: private:
friend class QGraphicsItem; friend class QGraphicsItem;
friend class QGraphicsItemPrivate; friend class QGraphicsItemPrivate;
@ -610,12 +604,7 @@ class QAbstractGraphicsShapeItemPrivate;
class Q_WIDGETS_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem class Q_WIDGETS_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem
{ {
public: public:
QAbstractGraphicsShapeItem(QGraphicsItem *parent = 0 QAbstractGraphicsShapeItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QAbstractGraphicsShapeItem(); ~QAbstractGraphicsShapeItem();
QPen pen() const; QPen pen() const;
@ -629,7 +618,7 @@ public:
protected: protected:
QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd, QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd,
QGraphicsItem *parent, QGraphicsScene *scene); QGraphicsItem *parent);
private: private:
Q_DISABLE_COPY(QAbstractGraphicsShapeItem) Q_DISABLE_COPY(QAbstractGraphicsShapeItem)
@ -640,18 +629,8 @@ class QGraphicsPathItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem class Q_WIDGETS_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem
{ {
public: public:
QGraphicsPathItem(QGraphicsItem *parent = 0 QGraphicsPathItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = 0);
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QGraphicsPathItem(); ~QGraphicsPathItem();
QPainterPath path() const; QPainterPath path() const;
@ -683,24 +662,9 @@ class QGraphicsRectItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem class Q_WIDGETS_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem
{ {
public: public:
QGraphicsRectItem(QGraphicsItem *parent = 0 QGraphicsRectItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = 0);
// ### obsolete argument QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0);
, QGraphicsScene *scene = 0
#endif
);
QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QGraphicsRectItem(); ~QGraphicsRectItem();
QRectF rect() const; QRectF rect() const;
@ -736,24 +700,9 @@ class QGraphicsEllipseItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem class Q_WIDGETS_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem
{ {
public: public:
QGraphicsEllipseItem(QGraphicsItem *parent = 0 QGraphicsEllipseItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = 0);
// ### obsolete argument QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0);
, QGraphicsScene *scene = 0
#endif
);
QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QGraphicsEllipseItem(); ~QGraphicsEllipseItem();
QRectF rect() const; QRectF rect() const;
@ -795,19 +744,9 @@ class QGraphicsPolygonItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem class Q_WIDGETS_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem
{ {
public: public:
QGraphicsPolygonItem(QGraphicsItem *parent = 0 QGraphicsPolygonItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsPolygonItem(const QPolygonF &polygon,
QGraphicsItem *parent = 0 QGraphicsItem *parent = 0);
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QGraphicsPolygonItem(); ~QGraphicsPolygonItem();
QPolygonF polygon() const; QPolygonF polygon() const;
@ -842,24 +781,9 @@ class QGraphicsLineItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsLineItem : public QGraphicsItem class Q_WIDGETS_EXPORT QGraphicsLineItem : public QGraphicsItem
{ {
public: public:
QGraphicsLineItem(QGraphicsItem *parent = 0 QGraphicsLineItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = 0);
// ### obsolete argument QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = 0);
, QGraphicsScene *scene = 0
#endif
);
QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QGraphicsLineItem(); ~QGraphicsLineItem();
QPen pen() const; QPen pen() const;
@ -902,18 +826,8 @@ public:
HeuristicMaskShape HeuristicMaskShape
}; };
QGraphicsPixmapItem(QGraphicsItem *parent = 0 QGraphicsPixmapItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = 0);
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QGraphicsPixmapItem(); ~QGraphicsPixmapItem();
QPixmap pixmap() const; QPixmap pixmap() const;
@ -964,18 +878,8 @@ class Q_WIDGETS_EXPORT QGraphicsTextItem : public QGraphicsObject
QDOC_PROPERTY(QTextCursor textCursor READ textCursor WRITE setTextCursor) QDOC_PROPERTY(QTextCursor textCursor READ textCursor WRITE setTextCursor)
public: public:
QGraphicsTextItem(QGraphicsItem *parent = 0 QGraphicsTextItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC QGraphicsTextItem(const QString &text, QGraphicsItem *parent = 0);
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsTextItem(const QString &text, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QGraphicsTextItem(); ~QGraphicsTextItem();
QString toHtml() const; QString toHtml() const;
@ -1065,18 +969,8 @@ class QGraphicsSimpleTextItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem class Q_WIDGETS_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem
{ {
public: public:
QGraphicsSimpleTextItem(QGraphicsItem *parent = 0 QGraphicsSimpleTextItem(QGraphicsItem *parent = 0);
#ifndef Q_QDOC QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = 0);
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = 0
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QGraphicsSimpleTextItem(); ~QGraphicsSimpleTextItem();
void setText(const QString &text); void setText(const QString &text);
@ -1111,12 +1005,7 @@ class QGraphicsItemGroupPrivate;
class Q_WIDGETS_EXPORT QGraphicsItemGroup : public QGraphicsItem class Q_WIDGETS_EXPORT QGraphicsItemGroup : public QGraphicsItem
{ {
public: public:
QGraphicsItemGroup(QGraphicsItem *parent = 0 QGraphicsItemGroup(QGraphicsItem *parent = 0);
#ifndef Q_QDOC
// ### obsolete argument
, QGraphicsScene *scene = 0
#endif
);
~QGraphicsItemGroup(); ~QGraphicsItemGroup();
void addToGroup(QGraphicsItem *item); void addToGroup(QGraphicsItem *item);

View File

@ -501,7 +501,7 @@ QPointF QGraphicsProxyWidgetPrivate::mapToReceiver(const QPointF &pos, const QWi
to QGraphicsItem's constructor. to QGraphicsItem's constructor.
*/ */
QGraphicsProxyWidget::QGraphicsProxyWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags) QGraphicsProxyWidget::QGraphicsProxyWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags)
: QGraphicsWidget(*new QGraphicsProxyWidgetPrivate, parent, 0, wFlags) : QGraphicsWidget(*new QGraphicsProxyWidgetPrivate, parent, wFlags)
{ {
Q_D(QGraphicsProxyWidget); Q_D(QGraphicsProxyWidget);
d->init(); d->init();

View File

@ -176,7 +176,7 @@ QT_BEGIN_NAMESPACE
window, a tool, a popup, etc). window, a tool, a popup, etc).
*/ */
QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags) QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags)
: QGraphicsObject(*new QGraphicsWidgetPrivate, 0, 0), QGraphicsLayoutItem(0, false) : QGraphicsObject(*new QGraphicsWidgetPrivate, 0), QGraphicsLayoutItem(0, false)
{ {
Q_D(QGraphicsWidget); Q_D(QGraphicsWidget);
d->init(parent, wFlags); d->init(parent, wFlags);
@ -187,8 +187,8 @@ QGraphicsWidget::QGraphicsWidget(QGraphicsItem *parent, Qt::WindowFlags wFlags)
Constructs a new QGraphicsWidget, using \a dd as parent. Constructs a new QGraphicsWidget, using \a dd as parent.
*/ */
QGraphicsWidget::QGraphicsWidget(QGraphicsWidgetPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene, Qt::WindowFlags wFlags) QGraphicsWidget::QGraphicsWidget(QGraphicsWidgetPrivate &dd, QGraphicsItem *parent, Qt::WindowFlags wFlags)
: QGraphicsObject(dd, 0, scene), QGraphicsLayoutItem(0, false) : QGraphicsObject(dd, 0), QGraphicsLayoutItem(0, false)
{ {
Q_D(QGraphicsWidget); Q_D(QGraphicsWidget);
d->init(parent, wFlags); d->init(parent, wFlags);

View File

@ -223,7 +223,7 @@ protected:
virtual void ungrabMouseEvent(QEvent *event); virtual void ungrabMouseEvent(QEvent *event);
virtual void grabKeyboardEvent(QEvent *event); virtual void grabKeyboardEvent(QEvent *event);
virtual void ungrabKeyboardEvent(QEvent *event); virtual void ungrabKeyboardEvent(QEvent *event);
QGraphicsWidget(QGraphicsWidgetPrivate &, QGraphicsItem *parent, QGraphicsScene *, Qt::WindowFlags wFlags = 0); QGraphicsWidget(QGraphicsWidgetPrivate &, QGraphicsItem *parent, Qt::WindowFlags wFlags = 0);
private: private:
Q_DISABLE_COPY(QGraphicsWidget) Q_DISABLE_COPY(QGraphicsWidget)

View File

@ -2200,7 +2200,8 @@ void tst_QGraphicsItem::setMatrix()
qRegisterMetaType<QList<QRectF> >("QList<QRectF>"); qRegisterMetaType<QList<QRectF> >("QList<QRectF>");
QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>))); QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>)));
QRectF unrotatedRect(-12, -34, 56, 78); QRectF unrotatedRect(-12, -34, 56, 78);
QGraphicsRectItem item(unrotatedRect, 0, &scene); QGraphicsRectItem item(unrotatedRect, 0);
scene.addItem(&item);
scene.update(scene.sceneRect()); scene.update(scene.sceneRect());
QApplication::instance()->processEvents(); QApplication::instance()->processEvents();
@ -2467,10 +2468,13 @@ void tst_QGraphicsItem::collidesWith_item()
{ {
QGraphicsScene scene; QGraphicsScene scene;
QGraphicsRectItem rect(20, 20, 100, 100, 0, &scene); QGraphicsRectItem rect(20, 20, 100, 100, 0);
QGraphicsRectItem rect2(40, 40, 50, 50, 0, &scene); scene.addItem(&rect);
QGraphicsRectItem rect2(40, 40, 50, 50, 0);
scene.addItem(&rect2);
rect2.setZValue(1); rect2.setZValue(1);
QGraphicsLineItem line(0, 0, 200, 200, 0, &scene); QGraphicsLineItem line(0, 0, 200, 200, 0);
scene.addItem(&line);
line.setZValue(2); line.setZValue(2);
QCOMPARE(scene.items().size(), 3); QCOMPARE(scene.items().size(), 3);
@ -6244,7 +6248,7 @@ public slots:
void newTextItem() void newTextItem()
{ {
// Add a text item // Add a text item
QGraphicsItem *item = new QGraphicsTextItem("This item will not ensure that it's visible", 0, this); QGraphicsItem *item = new QGraphicsTextItem("This item will not ensure that it's visible", 0);
item->setPos(.0, .0); item->setPos(.0, .0);
item->show(); item->show();
} }

View File

@ -3465,7 +3465,8 @@ void tst_QGraphicsScene::task139782_containsItemBoundingRect()
{ {
// The item in question has a scene bounding rect of (10, 10, 50, 50) // The item in question has a scene bounding rect of (10, 10, 50, 50)
QGraphicsScene scene(0.0, 0.0, 200.0, 200.0); QGraphicsScene scene(0.0, 0.0, 200.0, 200.0);
QGraphicsRectItem *item = new QGraphicsRectItem(0.0, 0.0, 50.0, 50.0, 0, &scene); QGraphicsRectItem *item = new QGraphicsRectItem(0.0, 0.0, 50.0, 50.0, 0);
scene.addItem(item);
item->setPos(10.0, 10.0); item->setPos(10.0, 10.0);
// The (0, 0, 50, 50) scene rect should not include the item's bounding rect // The (0, 0, 50, 50) scene rect should not include the item's bounding rect