From 09dd94091f88ca29b4f829b881fcedda4013e28d Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 15 Apr 2020 17:02:43 +0200 Subject: Remove deprecated members from graphics view classes Change-Id: Ia192de674b1085edcf4a88cdeada6df89b442ddd Reviewed-by: Shawn Rutledge --- src/widgets/graphicsview/qgraphicsitem.cpp | 97 ---------------------- src/widgets/graphicsview/qgraphicsitem.h | 13 --- .../graphicsview/qgraphicsitemanimation.cpp | 17 ---- src/widgets/graphicsview/qgraphicsitemanimation.h | 4 - src/widgets/graphicsview/qgraphicsscene.cpp | 90 +------------------- src/widgets/graphicsview/qgraphicsscene.h | 34 +------- src/widgets/graphicsview/qgraphicssceneevent.h | 3 - src/widgets/graphicsview/qgraphicsview.cpp | 2 - src/widgets/graphicsview/qgraphicsview.h | 9 +- 9 files changed, 8 insertions(+), 261 deletions(-) (limited to 'src') diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index ddb4e06fe2..12ee1713a9 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1849,15 +1849,6 @@ void QGraphicsItem::setParentItem(QGraphicsItem *newParent) d_ptr->setParentItemHelper(newParent, &newParentVariant, &thisPointerVariant); } -/*! - \fn QList QGraphicsItem::children() const - \obsolete - - Use childItems() instead. - - \sa setParentItem() -*/ - /*! \since 4.4 @@ -3170,12 +3161,6 @@ bool QGraphicsItem::acceptHoverEvents() const return d_ptr->acceptsHover; } -/*! - \fn bool QGraphicsItem::acceptsHoverEvents() const - \obsolete - - Call acceptHoverEvents() instead. -*/ /*! \since 4.4 @@ -3219,13 +3204,6 @@ void QGraphicsItem::setAcceptHoverEvents(bool enabled) } } -/*! - \fn void QGraphicsItem::setAcceptsHoverEvents(bool enabled) - \obsolete - - Use setAcceptHoverEvents(\a enabled) instead. -*/ - /*! \since 4.6 Returns \c true if an item accepts \l{QTouchEvent}{touch events}; @@ -4578,81 +4556,6 @@ void QGraphicsItem::resetTransform() setTransform(QTransform(), false); } -/*! - \fn void QGraphicsItem::rotate(qreal angle) - \obsolete - - Use - - \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 20 - - instead. - - Rotates the current item transformation \a angle degrees clockwise around - its origin. To translate around an arbitrary point (x, y), you need to - combine translation and rotation with setTransform(). - - Example: - - \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 6 - - \sa setTransform(), transform(), scale(), shear(), translate() -*/ - -/*! - \fn void QGraphicsItem::scale(qreal sx, qreal sy) - \obsolete - - Use - - \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 21 - - instead. - - Scales the current item transformation by (\a sx, \a sy) around its - origin. To scale from an arbitrary point (x, y), you need to combine - translation and scaling with setTransform(). - - Example: - - \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 7 - - \sa setTransform(), transform() -*/ - -/*! - \fn void QGraphicsItem::shear(qreal sh, qreal sv) - \obsolete - - Use - - \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 22 - - instead. - - Shears the current item transformation by (\a sh, \a sv). - - \sa setTransform(), transform() -*/ - -/*! - \fn void QGraphicsItem::translate(qreal dx, qreal dy) - \obsolete - - Use setPos() or setTransformOriginPoint() instead. For identical - behavior, use - - \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 23 - - Translates the current item transformation by (\a dx, \a dy). - - If all you want is to move an item, you should call moveBy() or - setPos() instead; this function changes the item's translation, - which is conceptually separate from its position. - - \sa setTransform(), transform() -*/ - /*! This virtual function is called twice for all items by the QGraphicsScene::advance() slot. In the first phase, all items are called diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h index 0fb46fc9a8..5989c428f1 100644 --- a/src/widgets/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -169,9 +169,6 @@ public: QGraphicsWidget *window() const; QGraphicsItem *panel() const; void setParentItem(QGraphicsItem *parent); -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline QList children() const { return childItems(); } -#endif QList childItems() const; bool isWidget() const; bool isWindow() const; @@ -233,10 +230,6 @@ public: Qt::MouseButtons acceptedMouseButtons() const; void setAcceptedMouseButtons(Qt::MouseButtons buttons); -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline bool acceptsHoverEvents() const { return acceptHoverEvents(); } - QT_DEPRECATED inline void setAcceptsHoverEvents(bool enabled) { setAcceptHoverEvents(enabled); } -#endif bool acceptHoverEvents() const; void setAcceptHoverEvents(bool enabled); bool acceptTouchEvents() const; @@ -287,12 +280,6 @@ public: QTransform itemTransform(const QGraphicsItem *other, bool *ok = nullptr) const; void setTransform(const QTransform &matrix, bool combine = false); void resetTransform(); -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline void rotate(qreal angle) { setTransform(QTransform().rotate(angle), true); } - QT_DEPRECATED inline void scale(qreal sx, qreal sy) { setTransform(QTransform::fromScale(sx, sy), true); } - QT_DEPRECATED inline void shear(qreal sh, qreal sv) { setTransform(QTransform().shear(sh, sv), true); } - QT_DEPRECATED inline void translate(qreal dx, qreal dy) { setTransform(QTransform::fromTranslate(dx, dy), true); } -#endif void setRotation(qreal angle); qreal rotation() const; diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp index 45b4871e24..981a4634bb 100644 --- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp +++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp @@ -550,23 +550,6 @@ void QGraphicsItemAnimation::setStep(qreal step) afterAnimationStep(step); } -#if QT_DEPRECATED_SINCE(5, 13) -/*! - Resets the item to its starting position and transformation. - - \obsolete - - You can call setStep(0) instead. -*/ -void QGraphicsItemAnimation::reset() -{ - if (!d->item) - return; - d->startPos = d->item->pos(); - d->startTransform = d->item->transform(); -} -#endif - /*! \fn void QGraphicsItemAnimation::beforeAnimationStep(qreal step) diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.h b/src/widgets/graphicsview/qgraphicsitemanimation.h index af54dfff93..2bd9206574 100644 --- a/src/widgets/graphicsview/qgraphicsitemanimation.h +++ b/src/widgets/graphicsview/qgraphicsitemanimation.h @@ -96,10 +96,6 @@ public: public Q_SLOTS: void setStep(qreal x); -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED_X("Use setStep(0) instead") - void reset(); -#endif protected: virtual void beforeAnimationStep(qreal step); diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 3a40452442..7c677f7d9c 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -1938,29 +1938,6 @@ void QGraphicsScene::setBspTreeDepth(int depth) bspTree->setBspTreeDepth(depth); } -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \property QGraphicsScene::sortCacheEnabled - \brief whether sort caching is enabled - \since 4.5 - \obsolete - - Since Qt 4.6, this property has no effect. -*/ -bool QGraphicsScene::isSortCacheEnabled() const -{ - Q_D(const QGraphicsScene); - return d->sortCacheEnabled; -} -void QGraphicsScene::setSortCacheEnabled(bool enabled) -{ - Q_D(QGraphicsScene); - if (d->sortCacheEnabled == enabled) - return; - d->sortCacheEnabled = enabled; -} -#endif - /*! Calculates and returns the bounding rect of all items on the scene. This function works by iterating over all items, and because of this, it can @@ -1990,18 +1967,6 @@ QList QGraphicsScene::items(Qt::SortOrder order) const return d->index->items(order); } -/*! - \fn QList QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode) const - \obsolete - \since 4.3 - - This convenience function is equivalent to calling items(QRectF(\a x, \a y, \a w, \a h), \a mode). - - This function is deprecated and returns incorrect results if the scene - contains items that ignore transformations. Use the overload that takes - a QTransform instead. -*/ - /*! \fn QList QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const \overload @@ -2150,23 +2115,6 @@ QList QGraphicsScene::collidingItems(const QGraphicsItem *item, return tmp; } -/*! - \fn QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const - \overload - \obsolete - - Returns the topmost visible item at the specified \a position, or - \nullptr if there are no items at this position. - - This function is deprecated and returns incorrect results if the scene - contains items that ignore transformations. Use the overload that takes - a QTransform instead. - - Note: See items() for a definition of which items are considered visible by this function. - - \sa items(), collidingItems(), {QGraphicsItem#Sorting}{Sorting} -*/ - /*! \since 4.6 @@ -2204,24 +2152,6 @@ QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform Note: See items() for a definition of which items are considered visible by this function. */ -/*! - \fn QGraphicsScene::itemAt(qreal x, qreal y) const - \overload - \obsolete - - Returns the topmost visible item at the position specified by (\a x, \a - y), or \nullptr if there are no items at this position. - - This convenience function is equivalent to calling \c - {itemAt(QPointF(x, y))}. - - This function is deprecated and returns incorrect results if the scene - contains items that ignore transformations. Use the overload that takes - a QTransform instead. - - Note: See items() for a definition of which items are considered visible by this function. -*/ - /*! Returns a list of all currently selected items. The items are returned in no particular order. @@ -2275,25 +2205,7 @@ QPainterPath QGraphicsScene::selectionArea() const */ void QGraphicsScene::setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform) { - setSelectionArea(path, Qt::IntersectsItemShape, deviceTransform); -} - -/*! - \overload - \since 4.6 - - Sets the selection area to \a path using \a mode to determine if items are - included in the selection area. - - \a deviceTransform is the transformation that applies to the view, and needs to - be provided if the scene contains items that ignore transformations. - - \sa clearSelection(), selectionArea() -*/ -void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, - const QTransform &deviceTransform) -{ - setSelectionArea(path, Qt::ReplaceSelection, mode, deviceTransform); + setSelectionArea(path, Qt::ReplaceSelection, Qt::IntersectsItemShape, deviceTransform); } /*! diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h index e459b80970..a4cf5b4063 100644 --- a/src/widgets/graphicsview/qgraphicsscene.h +++ b/src/widgets/graphicsview/qgraphicsscene.h @@ -101,9 +101,6 @@ class Q_WIDGETS_EXPORT QGraphicsScene : public QObject Q_PROPERTY(int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth) Q_PROPERTY(QPalette palette READ palette WRITE setPalette) Q_PROPERTY(QFont font READ font WRITE setFont) -#if QT_DEPRECATED_SINCE(5, 13) - Q_PROPERTY(bool sortCacheEnabled READ isSortCacheEnabled WRITE setSortCacheEnabled) -#endif Q_PROPERTY(bool stickyFocus READ stickyFocus WRITE setStickyFocus) Q_PROPERTY(qreal minimumRenderSize READ minimumRenderSize WRITE setMinimumRenderSize) Q_PROPERTY(bool focusOnTouch READ focusOnTouch WRITE setFocusOnTouch) @@ -141,11 +138,6 @@ public: ItemIndexMethod itemIndexMethod() const; void setItemIndexMethod(ItemIndexMethod method); -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED bool isSortCacheEnabled() const; - QT_DEPRECATED void setSortCacheEnabled(bool enabled); -#endif - int bspTreeDepth() const; void setBspTreeDepth(int depth); @@ -157,37 +149,19 @@ public: QList items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; QList items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; - - QList collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline QGraphicsItem *itemAt(const QPointF &position) const { - QList itemsAtPoint = items(position); - return itemsAtPoint.isEmpty() ? nullptr : itemsAtPoint.first(); - } -#endif - QGraphicsItem *itemAt(const QPointF &pos, const QTransform &deviceTransform) const; -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline QList 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 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); } -#if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED inline QGraphicsItem *itemAt(qreal x, qreal y) const { - QList itemsAtPoint = items(QPointF(x, y)); - return itemsAtPoint.isEmpty() ? nullptr : itemsAtPoint.first(); - } -#endif + + QList collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QGraphicsItem *itemAt(const QPointF &pos, const QTransform &deviceTransform) const; inline QGraphicsItem *itemAt(qreal x, qreal y, const QTransform &deviceTransform) const { return itemAt(QPointF(x, y), deviceTransform); } QList selectedItems() const; QPainterPath selectionArea() const; void setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform); - void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, const QTransform &deviceTransform = QTransform()); - void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionOperation selectionOperation, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, const QTransform &deviceTransform = QTransform()); - // ### Qt6 merge the last 2 functions and add a default: Qt::ItemSelectionOperation selectionOperation = Qt::ReplaceSelection + void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionOperation selectionOperation = Qt::ReplaceSelection, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, const QTransform &deviceTransform = QTransform()); QGraphicsItemGroup *createItemGroup(const QList &items); void destroyItemGroup(QGraphicsItemGroup *group); diff --git a/src/widgets/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h index 9d940be2c0..4a47b642fe 100644 --- a/src/widgets/graphicsview/qgraphicssceneevent.h +++ b/src/widgets/graphicsview/qgraphicssceneevent.h @@ -47,9 +47,6 @@ #include #include #include -#if QT_DEPRECATED_SINCE(5, 5) -#include -#endif QT_REQUIRE_CONFIG(graphicsview); diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index f7f33f9304..9c8042ba1a 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -198,8 +198,6 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < Note that setting a flag usually imposes a side effect, and this effect can vary between paint devices and platforms. - \value DontClipPainter This value is obsolete and has no effect. - \value DontSavePainterState When rendering, QGraphicsView protects the painter state (see QPainter::save()) when rendering the background or foreground, and when rendering each item. This allows you to leave the diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index 4c0b70bdd7..e69a5e7104 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -107,12 +107,9 @@ public: Q_ENUM(ViewportUpdateMode) enum OptimizationFlag { -#if QT_DEPRECATED_SINCE(5, 14) - DontClipPainter Q_DECL_ENUMERATOR_DEPRECATED_X("This flag is unused") = 0x1, // obsolete -#endif - DontSavePainterState = 0x2, - DontAdjustForAntialiasing = 0x4, - IndirectPainting = 0x8 + DontSavePainterState = 0x1, + DontAdjustForAntialiasing = 0x2, + IndirectPainting = 0x4 }; Q_DECLARE_FLAGS(OptimizationFlags, OptimizationFlag) -- cgit v1.2.3