Remove deprecated members from graphics view classes
Change-Id: Ia192de674b1085edcf4a88cdeada6df89b442ddd Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
90295dcd03
commit
09dd94091f
@ -1849,15 +1849,6 @@ void QGraphicsItem::setParentItem(QGraphicsItem *newParent)
|
||||
d_ptr->setParentItemHelper(newParent, &newParentVariant, &thisPointerVariant);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QList<QGraphicsItem *> 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
|
||||
|
@ -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<QGraphicsItem *> children() const { return childItems(); }
|
||||
#endif
|
||||
QList<QGraphicsItem *> 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;
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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<QGraphicsItem *> QGraphicsScene::items(Qt::SortOrder order) const
|
||||
return d->index->items(order);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QList<QGraphicsItem *> 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<QGraphicsItem *> 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<QGraphicsItem *> 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);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -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<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;
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
QT_DEPRECATED inline QGraphicsItem *itemAt(const QPointF &position) const {
|
||||
QList<QGraphicsItem *> 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<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); }
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
QT_DEPRECATED inline QGraphicsItem *itemAt(qreal x, qreal y) const {
|
||||
QList<QGraphicsItem *> itemsAtPoint = items(QPointF(x, y));
|
||||
return itemsAtPoint.isEmpty() ? nullptr : itemsAtPoint.first();
|
||||
}
|
||||
#endif
|
||||
|
||||
QList<QGraphicsItem *> 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<QGraphicsItem *> 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<QGraphicsItem *> &items);
|
||||
void destroyItemGroup(QGraphicsItemGroup *group);
|
||||
|
@ -47,9 +47,6 @@
|
||||
#include <QtCore/qrect.h>
|
||||
#include <QtGui/qpolygon.h>
|
||||
#include <QtCore/qset.h>
|
||||
#if QT_DEPRECATED_SINCE(5, 5)
|
||||
#include <QtCore/qhash.h>
|
||||
#endif
|
||||
|
||||
QT_REQUIRE_CONFIG(graphicsview);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -252,7 +252,6 @@ void MainView::construct()
|
||||
#ifndef QT_NO_OPENGL
|
||||
if (m_enableOpenGL) {
|
||||
qDebug() << "OpenGL enabled";
|
||||
m_scene->setSortCacheEnabled(false);
|
||||
setViewport(new QOpenGLWidget);
|
||||
|
||||
// Qt doc says: This is the preferred update mode for
|
||||
|
@ -423,23 +423,17 @@ static void addChildHelper(QGraphicsItem *parent, int n, bool rotate)
|
||||
void tst_QGraphicsView::deepNesting_data()
|
||||
{
|
||||
QTest::addColumn<bool>("rotate");
|
||||
QTest::addColumn<bool>("sortCache");
|
||||
QTest::addColumn<bool>("bsp");
|
||||
|
||||
QTest::newRow("bsp, no transform") << false << false << true;
|
||||
QTest::newRow("bsp, rotation") << true << false << true;
|
||||
QTest::newRow("bsp, no transform, sort cache") << false << true << true;
|
||||
QTest::newRow("bsp, rotation, sort cache") << true << true << true;
|
||||
QTest::newRow("no transform") << false << false << false;
|
||||
QTest::newRow("rotation") << true << false << false;
|
||||
QTest::newRow("no transform, sort cache") << false << true << false;
|
||||
QTest::newRow("rotation, sort cache") << true << true << false;
|
||||
QTest::newRow("bsp, no transform") << false << true;
|
||||
QTest::newRow("bsp, rotation") << true << true;
|
||||
QTest::newRow("no transform") << false << false;
|
||||
QTest::newRow("rotation") << true << false;
|
||||
}
|
||||
|
||||
void tst_QGraphicsView::deepNesting()
|
||||
{
|
||||
QFETCH(bool, rotate);
|
||||
QFETCH(bool, sortCache);
|
||||
QFETCH(bool, bsp);
|
||||
|
||||
QGraphicsScene scene;
|
||||
@ -453,7 +447,6 @@ void tst_QGraphicsView::deepNesting()
|
||||
}
|
||||
}
|
||||
scene.setItemIndexMethod(bsp ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex);
|
||||
scene.setSortCacheEnabled(sortCache);
|
||||
scene.setSceneRect(scene.sceneRect());
|
||||
|
||||
mView.setRenderHint(QPainter::Antialiasing);
|
||||
|
Loading…
Reference in New Issue
Block a user