From 0f035c0ad79ca41a1473b64a4c0077e7085d3700 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 27 May 2019 15:04:25 +0200 Subject: Fix deprecation warnings in 5.14 Libraries: scenegraph/util/qsgdepthstencilbuffer.cpp:186:57: warning: 'T* QWeakPointer::data() const [with T = QSGDepthStencilBuffer]' is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations] scenegraph/qsgdefaultcontext.cpp:163:89: warning: 'QList QSet::toList() const [with T = QByteArray]' is deprecated: Use values() instead. [-Wdeprecated-declarations] util/qquickpath.cpp:573:40: warning: 'QList QSet::toList() const [with T = QString]' is deprecated: Use values() instead. [-Wdeprecated-declarations] util/qquickpath.cpp:606:29: warning: 'QList QSet::toList() const [with T = QString]' is deprecated: Use values() instead. [-Wdeprecated-declarations] quicktest.cpp:562:73: warning: 'QSet QList::toSet() const [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] quicktest.cpp:604:77: warning: 'QSet QList::toSet() const [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] qquickitemparticle.cpp:233:49: warning: 'static QSet QSet::fromList(const QList&) [with T = QQuickItem*]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] qquickitemparticle.cpp:239:37: warning: 'QList QSet::toList() const [with T = QQuickItem*]' is deprecated: Use values() instead. [-Wdeprecated-declarations] Tests: tst_propertyrequirements.cpp:123:58: warning: 'QList QSet::toList() const [with T = QString]' is deprecated: Use values() instead. [-Wdeprecated-declarations] tst_propertyrequirements.cpp:161:40: warning: 'static QSet QSet::fromList(const QList&) [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_propertyrequirements.cpp:161:77: warning: 'static QSet QSet::fromList(const QList&) [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] /data1/frkleint/qt-dev/qtbase/include/QtCore/../../src/corelib/tools/qset.h:400:23: warning: 'QSet QList::toSet() const [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] ../shared/viewtestutil.cpp:331:26: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] ... tst_qmldiskcache.cpp:651:81: warning: 'QSet QList::toSet() const [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qmldiskcache.cpp:663:81: warning: 'QSet QList::toSet() const [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qmldiskcache.cpp:693:85: warning: 'QSet QList::toSet() const [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qmldiskcache.cpp:918:81: warning: 'QSet QList::toSet() const [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qmldiskcache.cpp:940:69: warning: 'QSet QList::toSet() const [with T = QString]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qquickgridview.cpp:6437:70: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qquickgridview.cpp:6438:46: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qquickgridview.cpp:6440:66: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qquicktableview.cpp:53:20: warning: 'kTableViewPropName' defined but not used [-Wunused-variable] tst_qquicklistview.cpp:7269:70: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qquicklistview.cpp:7270:46: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qquicklistview.cpp:7272:66: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qquickpositioners.cpp:4033:70: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qquickpositioners.cpp:4034:46: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] tst_qquickpositioners.cpp:4036:66: warning: 'QSet QList::toSet() const [with T = int]' is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] Change-Id: I9a177f83f07ae5162f7cc231a8c164ba32ffa5bc Reviewed-by: Simon Hausmann --- src/particles/qquickitemparticle.cpp | 4 ++-- src/qmltest/quicktest.cpp | 4 ++-- src/quick/scenegraph/qsgdefaultcontext.cpp | 2 +- .../scenegraph/util/qsgdepthstencilbuffer.cpp | 2 +- src/quick/util/qquickpath.cpp | 4 ++-- tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp | 27 ++++++++++++++-------- .../tst_propertyrequirements.cpp | 5 ++-- .../quick/qquickgridview/tst_qquickgridview.cpp | 8 ++++--- .../quick/qquicklistview/tst_qquicklistview.cpp | 8 ++++--- .../qquickpositioners/tst_qquickpositioners.cpp | 8 ++++--- tests/auto/quick/shared/viewtestutil.cpp | 3 ++- 11 files changed, 45 insertions(+), 30 deletions(-) diff --git a/src/particles/qquickitemparticle.cpp b/src/particles/qquickitemparticle.cpp index c5c18a201c..e68ea54707 100644 --- a/src/particles/qquickitemparticle.cpp +++ b/src/particles/qquickitemparticle.cpp @@ -230,13 +230,13 @@ void QQuickItemParticle::reset() // delete all managed items which had their logical particles cleared // but leave it alone if the logical particle is maintained - QSet lost = QSet::fromList(m_managed); + QSet lost = QSet(m_managed.cbegin(), m_managed.cend()); for (auto groupId : groupIds()) { for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { lost.remove(d->delegate); } } - m_deletables.append(lost.toList()); + m_deletables.append(lost.values()); //TODO: This doesn't yet handle calling detach on taken particles in the system reset case processDeletables(); } diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 6aff7af0e7..2b0205cdd4 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -559,7 +559,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch // Register the test object qmlRegisterSingletonType("Qt.test.qtestroot", 1, 0, "QTestRootObject", testRootObject); - QSet commandLineTestFunctions = QTest::testFunctions.toSet(); + QSet commandLineTestFunctions(QTest::testFunctions.cbegin(), QTest::testFunctions.cend()); const bool filteringTestFunctions = !commandLineTestFunctions.isEmpty(); // Scan through all of the "tst_*.qml" files and run each of them @@ -601,7 +601,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch continue; } - const QSet availableTestSet = availableTestFunctions.toSet(); + const QSet availableTestSet(availableTestFunctions.cbegin(), availableTestFunctions.cend()); if (filteringTestFunctions && !availableTestSet.intersects(commandLineTestFunctions)) continue; commandLineTestFunctions.subtract(availableTestSet); diff --git a/src/quick/scenegraph/qsgdefaultcontext.cpp b/src/quick/scenegraph/qsgdefaultcontext.cpp index 70b74b8877..a5b2b04c93 100644 --- a/src/quick/scenegraph/qsgdefaultcontext.cpp +++ b/src/quick/scenegraph/qsgdefaultcontext.cpp @@ -160,7 +160,7 @@ void QSGDefaultContext::renderContextInitialized(QSGRenderContext *renderContext qCDebug(QSG_LOG_INFO, "GL_RENDERER: %s", (const char*)funcs->glGetString(GL_RENDERER)); qCDebug(QSG_LOG_INFO, "GL_VERSION: %s", (const char*)funcs->glGetString(GL_VERSION)); - QByteArrayList exts = openglRenderContext->openglContext()->extensions().toList(); + QByteArrayList exts = openglRenderContext->openglContext()->extensions().values(); std::sort(exts.begin(), exts.end()); qCDebug(QSG_LOG_INFO, "GL_EXTENSIONS: %s", exts.join(' ').constData()); qCDebug(QSG_LOG_INFO, "Max Texture Size: %d", openglRenderContext->maxTextureSize()); diff --git a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp index 94912778f8..a850f72053 100644 --- a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp +++ b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp @@ -183,7 +183,7 @@ void QSGDefaultDepthStencilBuffer::free() QSGDepthStencilBufferManager::~QSGDepthStencilBufferManager() { for (Hash::const_iterator it = m_buffers.constBegin(), cend = m_buffers.constEnd(); it != cend; ++it) { - QSGDepthStencilBuffer *buffer = it.value().data(); + QSGDepthStencilBuffer *buffer = it.value().toStrongRef().data(); buffer->free(); buffer->m_manager = nullptr; } diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 60d725d650..16723b997e 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -570,7 +570,7 @@ void QQuickPath::gatherAttributes() attributes.insert(attribute->name()); } - d->_attributes = attributes.toList(); + d->_attributes = attributes.values(); } void QQuickPath::componentComplete() @@ -603,7 +603,7 @@ QStringList QQuickPath::attributes() const qobject_cast(pathElement)) attrs.insert(attribute->name()); } - return attrs.toList(); + return attrs.values(); } return d->_attributes; } diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp index c215e9620d..23be541a72 100644 --- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp +++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp @@ -645,10 +645,21 @@ void tst_qmldiskcache::localAliases() } } +static QSet entrySet(const QDir &dir) +{ + const auto &list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot); + return QSet(list.cbegin(), list.cend()); +} + +static QSet entrySet(const QDir &dir, const QStringList &filters) +{ + const auto &list = dir.entryList(filters); + return QSet(list.cbegin(), list.cend()); +} + void tst_qmldiskcache::cacheResources() { - const QSet existingFiles = - m_qmlCacheDirectory.entryList(QDir::Files | QDir::NoDotAndDotDot).toSet(); + const QSet existingFiles = entrySet(m_qmlCacheDirectory); QQmlEngine engine; @@ -659,8 +670,7 @@ void tst_qmldiskcache::cacheResources() QCOMPARE(obj->property("value").toInt(), 20); } - const QSet entries = - m_qmlCacheDirectory.entryList(QDir::NoDotAndDotDot | QDir::Files).toSet().subtract(existingFiles); + const QSet entries = entrySet(m_qmlCacheDirectory).subtract(existingFiles); QCOMPARE(entries.count(), 1); QDateTime cacheFileTimeStamp; @@ -689,8 +699,7 @@ void tst_qmldiskcache::cacheResources() } { - const QSet entries = - m_qmlCacheDirectory.entryList(QDir::NoDotAndDotDot | QDir::Files).toSet().subtract(existingFiles); + const QSet entries = entrySet(m_qmlCacheDirectory).subtract(existingFiles); QCOMPARE(entries.count(), 1); QCOMPARE(QFileInfo(m_qmlCacheDirectory.absoluteFilePath(*entries.cbegin())).lastModified().toMSecsSinceEpoch(), @@ -914,8 +923,7 @@ void tst_qmldiskcache::cppRegisteredSingletonDependency() void tst_qmldiskcache::cacheModuleScripts() { - const QSet existingFiles = - m_qmlCacheDirectory.entryList(QDir::Files | QDir::NoDotAndDotDot).toSet(); + const QSet existingFiles = entrySet(m_qmlCacheDirectory); QQmlEngine engine; @@ -936,8 +944,7 @@ void tst_qmldiskcache::cacheModuleScripts() QVERIFY(!compilationUnit->backingFile.isNull()); } - const QSet entries = - m_qmlCacheDirectory.entryList(QStringList("*.mjsc")).toSet().subtract(existingFiles); + const QSet entries = entrySet(m_qmlCacheDirectory, QStringList("*.mjsc")); QCOMPARE(entries.count(), 1); diff --git a/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp b/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp index 5781a007b6..ca348eea03 100644 --- a/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp +++ b/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp @@ -120,7 +120,7 @@ void tst_PropertyRequirements::constantOrNotifyableFull() } static const QString messagePattern("\nProperty %1 neither CONSTANT nor NOTIFYable. Affected types:\n\t%2"); - QStringList occurrencesList = occurrences.toList(); + QStringList occurrencesList = occurrences.values(); occurrencesList.sort(); messages.append(messagePattern.arg(it.key(), occurrencesList.join("\n\t"))); @@ -158,7 +158,8 @@ void tst_PropertyRequirements::testAllQmlTypes(TestDepth testDepth, FailuresByPr testQmlType(testDepth, qmlType, failuresByProperty); } } - seenTypes.unite(QSet::fromList(QQmlMetaType::qmlTypeNames())); + const auto &typeNameList = QQmlMetaType::qmlTypeNames(); + seenTypes.unite(QSet(typeNameList.cbegin(), typeNameList.cend())); } } diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index b65b8770b1..46e3457d6e 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -6433,11 +6433,13 @@ QList tst_QQuickGridView::toIntList(const QVariantList &list) void tst_QQuickGridView::matchIndexLists(const QVariantList &indexLists, const QList &expectedIndexes) { + const QSet expectedIndexSet(expectedIndexes.cbegin(), expectedIndexes.cend()); for (int i=0; i current = indexLists[i].value >().toSet(); - if (current != expectedIndexes.toSet()) + const auto ¤tList = indexLists[i].value >(); + const QSet current(currentList.cbegin(), currentList.cend()); + if (current != expectedIndexSet) qDebug() << "Cannot match actual targets" << current << "with expected" << expectedIndexes; - QCOMPARE(current, expectedIndexes.toSet()); + QCOMPARE(current, expectedIndexSet); } } diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 894a5ee16e..7d5ad1b604 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -7265,11 +7265,13 @@ QList tst_QQuickListView::toIntList(const QVariantList &list) void tst_QQuickListView::matchIndexLists(const QVariantList &indexLists, const QList &expectedIndexes) { + const QSet expectedIndexSet(expectedIndexes.cbegin(), expectedIndexes.cend()); for (int i=0; i current = indexLists[i].value >().toSet(); - if (current != expectedIndexes.toSet()) + const auto ¤tList = indexLists[i].value >(); + const QSet current(currentList.cbegin(), currentList.cend()); + if (current != expectedIndexSet) qDebug() << "Cannot match actual targets" << current << "with expected" << expectedIndexes; - QCOMPARE(current, expectedIndexes.toSet()); + QCOMPARE(current, expectedIndexSet); } } diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp index 80be25d1b0..d3c0f345b9 100644 --- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp +++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp @@ -4029,11 +4029,13 @@ QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait void tst_qquickpositioners::matchIndexLists(const QVariantList &indexLists, const QList &expectedIndexes) { + const QSet expectedIndexSet(expectedIndexes.cbegin(), expectedIndexes.cend()); for (int i=0; i current = indexLists[i].value >().toSet(); - if (current != expectedIndexes.toSet()) + const auto ¤tList = indexLists[i].value >(); + const QSet current(currentList.cbegin(), currentList.cend()); + if (current != expectedIndexSet) qDebug() << "Cannot match actual targets" << current << "with expected" << expectedIndexes; - QCOMPARE(current, expectedIndexes.toSet()); + QCOMPARE(current, expectedIndexSet); } } diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp index 5631ffe047..1680e850f7 100644 --- a/tests/auto/quick/shared/viewtestutil.cpp +++ b/tests/auto/quick/shared/viewtestutil.cpp @@ -328,7 +328,8 @@ QQuickViewTestUtil::ListRange QQuickViewTestUtil::ListRange::operator+(const Lis bool QQuickViewTestUtil::ListRange::operator==(const ListRange &other) const { - return indexes.toSet() == other.indexes.toSet(); + return QSet(indexes.cbegin(), indexes.cend()) + == QSet(other.indexes.cbegin(), other.indexes.cend()); } bool QQuickViewTestUtil::ListRange::operator!=(const ListRange &other) const -- cgit v1.2.3