diff options
author | Gatis Paeglis <gatis.paeglis@nokia.com> | 2012-05-16 15:24:24 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-26 10:15:36 +0200 |
commit | 02b80ebb52b957ae65cc23f5c9464633d9de868d (patch) | |
tree | 5b0c21865da0e3e662c08d6cf4a8f673e6a1b50d /src/widgets/graphicsview | |
parent | 2defa750b7742a4ba33e912b816ba7a19409d0e2 (diff) |
Fix To-Do's in QGraphicsScene.
Mark obsolete functions with QT_DEPRECATED.
Task-number: QTBUG-25092
Change-Id: I89d9e508479b75ad2d8bf131c69f6158b71fcda8
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 134 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.h | 42 |
2 files changed, 22 insertions, 154 deletions
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 21db5bd53a..a63403a039 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -1933,17 +1933,6 @@ QRectF QGraphicsScene::itemsBoundingRect() const } /*! - Returns a list of all items in the scene in descending stacking order. - - \sa addItem(), removeItem(), {QGraphicsItem#Sorting}{Sorting} -*/ -QList<QGraphicsItem *> QGraphicsScene::items() const -{ - Q_D(const QGraphicsScene); - return d->index->items(Qt::DescendingOrder); -} - -/*! Returns an ordered list of all items on the scene. \a order decides the stacking order. @@ -1956,47 +1945,6 @@ QList<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const } /*! - \obsolete - - Returns all visible items at position \a pos in the scene. The items are - listed in descending stacking order (i.e., the first item in the list is the - top-most item, and the last item is the bottom-most item). - - This function is deprecated and returns incorrect results if the scene - contains items that ignore transformations. Use the overload that takes - a QTransform instead. - - \sa itemAt(), {QGraphicsItem#Sorting}{Sorting} -*/ -QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos) const -{ - Q_D(const QGraphicsScene); - return d->index->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder); -} - -/*! - \overload - \obsolete - - Returns all visible items that, depending on \a mode, are either inside or - intersect with the specified \a rectangle. - - The default value for \a mode is Qt::IntersectsItemShape; all items whose - exact shape intersects with or is contained by \a rectangle are returned. - - This function is deprecated and returns incorrect results if the scene - contains items that ignore transformations. Use the overload that takes - a QTransform instead. - - \sa itemAt(), {QGraphicsItem#Sorting}{Sorting} -*/ -QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSelectionMode mode) const -{ - Q_D(const QGraphicsScene); - return d->index->items(rectangle, mode, Qt::DescendingOrder); -} - -/*! \fn QList<QGraphicsItem *> QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode) const \obsolete \since 4.3 @@ -2022,52 +1970,6 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rectangle, Qt::ItemSe */ /*! - \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode) const - \overload - \obsolete - - Returns all visible items that, depending on \a mode, are either inside or - intersect with the polygon \a polygon. - - The default value for \a mode is Qt::IntersectsItemShape; all items whose - exact shape intersects with or is contained by \a polygon are returned. - - This function is deprecated and returns incorrect results if the scene - contains items that ignore transformations. Use the overload that takes - a QTransform instead. - - \sa itemAt(), {QGraphicsItem#Sorting}{Sorting} -*/ -QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemSelectionMode mode) const -{ - Q_D(const QGraphicsScene); - return d->index->items(polygon, mode, Qt::DescendingOrder); -} - -/*! - \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const - \overload - \obsolete - - Returns all visible items that, depending on \a path, are either inside or - intersect with the path \a path. - - The default value for \a mode is Qt::IntersectsItemShape; all items whose - exact shape intersects with or is contained by \a path are returned. - - This function is deprecated and returns incorrect results if the scene - contains items that ignore transformations. Use the overload that takes - a QTransform instead. - - \sa itemAt(), {QGraphicsItem#Sorting}{Sorting} -*/ -QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) const -{ - Q_D(const QGraphicsScene); - return d->index->items(path, mode, Qt::DescendingOrder); -} - -/*! \fn QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const \since 4.6 @@ -2192,6 +2094,7 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item, } /*! + \fn QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const \overload \obsolete @@ -2204,11 +2107,6 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item, \sa items(), collidingItems(), {QGraphicsItem#Sorting}{Sorting} */ -QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const -{ - QList<QGraphicsItem *> itemsAtPoint = items(position); - return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); -} /*! \since 4.6 @@ -2316,36 +2214,6 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path, const QTransform } /*! - \obsolete - \overload - - Sets the selection area to \a path. - - This function is deprecated and leads to incorrect results if the scene - contains items that ignore transformations. Use the overload that takes - a QTransform instead. -*/ -void QGraphicsScene::setSelectionArea(const QPainterPath &path) -{ - setSelectionArea(path, Qt::IntersectsItemShape, QTransform()); -} - -/*! - \obsolete - \overload - \since 4.3 - - Sets the selection area to \a path using \a mode to determine if items are - included in the selection area. - - \sa clearSelection(), selectionArea() -*/ -void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode) -{ - setSelectionArea(path, mode, QTransform()); -} - -/*! \overload \since 4.6 diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h index ee4edb391e..a941f94893 100644 --- a/src/widgets/graphicsview/qgraphicsscene.h +++ b/src/widgets/graphicsview/qgraphicsscene.h @@ -151,40 +151,40 @@ public: QRectF itemsBoundingRect() const; - QList<QGraphicsItem *> items() const; - QList<QGraphicsItem *> items(Qt::SortOrder order) const; // ### Qt 5: unify + QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const; - QList<QGraphicsItem *> items(const QPointF &pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; - - QList<QGraphicsItem *> items(const QPointF &pos) const; // ### obsolete - QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete - QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete - QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; // ### obsolete + QList<QGraphicsItem *> items(const QPointF &pos, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; + QList<QGraphicsItem *> items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; + QList<QGraphicsItem *> items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; + QList<QGraphicsItem *> items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; QList<QGraphicsItem *> collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; - - QGraphicsItem *itemAt(const QPointF &pos) const; // ### obsolete +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline QGraphicsItem *itemAt(const QPointF &position) const { + QList<QGraphicsItem *> itemsAtPoint = items(position); + return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first(); + } +#endif QGraphicsItem *itemAt(const QPointF &pos, const QTransform &deviceTransform) const; - - inline QList<QGraphicsItem *> items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const - { return items(QRectF(x, y, w, h), mode); } // ### obsolete +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline QList<QGraphicsItem *> items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const + { return items(QRectF(x, y, w, h), mode); } +#endif inline QList<QGraphicsItem *> items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const { return items(QRectF(x, y, w, h), mode, order, deviceTransform); } - inline QGraphicsItem *itemAt(qreal x, qreal y) const // ### obsolete - { return itemAt(QPointF(x, y)); } +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline QGraphicsItem *itemAt(qreal x, qreal y) const { + return itemAt(QPointF(x, y)); + } +#endif inline QGraphicsItem *itemAt(qreal x, qreal y, const QTransform &deviceTransform) const { return itemAt(QPointF(x, y), deviceTransform); } QList<QGraphicsItem *> selectedItems() const; QPainterPath selectionArea() const; - void setSelectionArea(const QPainterPath &path); // ### obsolete void setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform); - void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode); // ### obsolete - void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, const QTransform &deviceTransform); + void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, const QTransform &deviceTransform = QTransform()); QGraphicsItemGroup *createItemGroup(const QList<QGraphicsItem *> &items); void destroyItemGroup(QGraphicsItemGroup *group); |