From 92f984273262531f909ede17a324f546fe502b5c Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 6 May 2019 14:00:53 +0200 Subject: Deprecate conversion functions between QList and QSet Users should use range constructors instead to do the conversion. Keep conversion methods between QList and QVector as these will turn into a no-op in Qt 6, whereas forcing people to use range constructors would lead to deep copies of the data. Change-Id: Id9fc9e4d007044e019826da523e8418857c91283 Reviewed-by: Simon Hausmann --- src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp | 2 +- src/widgets/graphicsview/qgraphicsscene.cpp | 10 +++++----- src/widgets/graphicsview/qsimplex_p.cpp | 2 +- src/widgets/itemviews/qtableview.cpp | 4 ++-- src/widgets/kernel/qapplication.cpp | 2 +- src/widgets/kernel/qgesturemanager.cpp | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp index 008560d856..4f44373cad 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2066,7 +2066,7 @@ QList getVariables(const QList &constraints) for (auto it = c->variables.cbegin(), end = c->variables.cend(); it != end; ++it) variableSet.insert(static_cast(it.key())); } - return variableSet.toList(); + return variableSet.values(); } /*! diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 3897823e98..e5bd65d61e 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -6352,7 +6352,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) << "delivering override to" << item.data() << gestures; // send gesture override - QGestureEvent ev(gestures.toList()); + QGestureEvent ev(gestures.values()); ev.t = QEvent::GestureOverride; ev.setWidget(event->widget()); // mark event and individual gestures as ignored @@ -6442,7 +6442,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" << "delivering to" << receiver.data() << gestures; - QGestureEvent ev(gestures.toList()); + QGestureEvent ev(gestures.values()); ev.setWidget(event->widget()); sendEvent(receiver.data(), &ev); QSet ignoredGestures; @@ -6473,7 +6473,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) // look for new potential targets for gestures that were ignored // and should be propagated. - QSet targetsSet = cachedTargetItems.toSet(); + QSet targetsSet(cachedTargetItems.constBegin(), cachedTargetItems.constEnd()); if (receiver) { // first if the gesture should be propagated to parents only @@ -6505,7 +6505,7 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event) gestureTargetsAtHotSpots(ignoredGestures, Qt::ReceivePartialGestures, &cachedItemGestures, &targetsSet, 0, 0); - cachedTargetItems = targetsSet.toList(); + cachedTargetItems = targetsSet.values(); std::sort(cachedTargetItems.begin(), cachedTargetItems.end(), qt_closestItemFirst); DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:" << "new targets:" << cachedTargetItems; @@ -6583,7 +6583,7 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original) } Q_ASSERT(target); - const QList list = gestures.toList(); + const QList list = gestures.values(); QGestureEvent ev(list); sendEvent(target, &ev); diff --git a/src/widgets/graphicsview/qsimplex_p.cpp b/src/widgets/graphicsview/qsimplex_p.cpp index e6ffa856f1..e18f1fa4c4 100644 --- a/src/widgets/graphicsview/qsimplex_p.cpp +++ b/src/widgets/graphicsview/qsimplex_p.cpp @@ -164,7 +164,7 @@ bool QSimplex::setConstraints(const QList &newConstraints) for (auto it = v.cbegin(), end = v.cend(); it != end; ++it) variablesSet.insert(it.key()); } - variables = variablesSet.toList(); + variables = variablesSet.values(); // Set Variables reverse mapping // We also need to be able to find the index for a given variable, to do that diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 9e9aa63b53..0e03ff2a97 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -191,7 +191,7 @@ QList QSpanCollection::spansInRect(int x, int y, int w, break; --it_y; } - return list.toList(); + return list.values(); } #undef DEBUG_SPAN_UPDATE @@ -875,7 +875,7 @@ void QTableViewPrivate::drawAndClipSpans(const QRegion &area, QPainter *painter, for(int y = firstVisualRow; y <= lastVisualRow; y++) set.insert(spans.spanAt(x,y)); set.remove(0); - visibleSpans = set.toList(); + visibleSpans = set.values(); } for (QSpanCollection::Span *span : qAsConst(visibleSpans)) { diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index c1c4014c6b..ca48a9e145 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1721,7 +1721,7 @@ QWidgetList QApplication::topLevelWidgets() QWidgetList QApplication::allWidgets() { if (QWidgetPrivate::allWidgets) - return QWidgetPrivate::allWidgets->toList(); + return QWidgetPrivate::allWidgets->values(); return QWidgetList(); } diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index cd27c9c5be..390602205c 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -171,7 +171,7 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ while (iter != m_objectGestures.end()) { ObjectGesture objectGesture = iter.key(); if (objectGesture.gesture == type && target == objectGesture.object) { - QSet gestures = iter.value().toSet(); + QSet gestures = QSet(iter.value().constBegin(), iter.value().constEnd()); for (QHash >::iterator it = m_obsoleteGestures.begin(), e = m_obsoleteGestures.end(); it != e; ++it) { it.value() -= gestures; -- cgit v1.2.3