diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-27 15:04:25 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-29 23:47:31 +0200 |
commit | 0f035c0ad79ca41a1473b64a4c0077e7085d3700 (patch) | |
tree | 9295f556711a6230c812e1c8f5feee2782d6b3a7 /tests/auto | |
parent | 9d61684d70c8691d81536b7b519388586e2cbbb8 (diff) |
Fix deprecation warnings in 5.14
Libraries:
scenegraph/util/qsgdepthstencilbuffer.cpp:186:57: warning: 'T* QWeakPointer<T>::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<T> QSet<T>::toList() const [with T = QByteArray]' is deprecated: Use values() instead. [-Wdeprecated-declarations]
util/qquickpath.cpp:573:40: warning: 'QList<T> QSet<T>::toList() const [with T = QString]' is deprecated: Use values() instead. [-Wdeprecated-declarations]
util/qquickpath.cpp:606:29: warning: 'QList<T> QSet<T>::toList() const [with T = QString]' is deprecated: Use values() instead. [-Wdeprecated-declarations]
quicktest.cpp:562:73: warning: 'QSet<T> QList<T>::toSet() const [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
quicktest.cpp:604:77: warning: 'QSet<T> QList<T>::toSet() const [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
qquickitemparticle.cpp:233:49: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QQuickItem*]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
qquickitemparticle.cpp:239:37: warning: 'QList<T> QSet<T>::toList() const [with T = QQuickItem*]' is deprecated: Use values() instead. [-Wdeprecated-declarations]
Tests:
tst_propertyrequirements.cpp:123:58: warning: 'QList<T> QSet<T>::toList() const [with T = QString]' is deprecated: Use values() instead. [-Wdeprecated-declarations]
tst_propertyrequirements.cpp:161:40: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_propertyrequirements.cpp:161:77: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
/data1/frkleint/qt-dev/qtbase/include/QtCore/../../src/corelib/tools/qset.h:400:23: warning: 'QSet<T> QList<T>::toSet() const [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
../shared/viewtestutil.cpp:331:26: warning: 'QSet<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
...
tst_qmldiskcache.cpp:651:81: warning: 'QSet<T> QList<T>::toSet() const [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qmldiskcache.cpp:663:81: warning: 'QSet<T> QList<T>::toSet() const [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qmldiskcache.cpp:693:85: warning: 'QSet<T> QList<T>::toSet() const [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qmldiskcache.cpp:918:81: warning: 'QSet<T> QList<T>::toSet() const [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qmldiskcache.cpp:940:69: warning: 'QSet<T> QList<T>::toSet() const [with T = QString]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qquickgridview.cpp:6437:70: warning: 'QSet<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qquickgridview.cpp:6438:46: warning: 'QSet<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qquickgridview.cpp:6440:66: warning: 'QSet<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(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<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qquicklistview.cpp:7270:46: warning: 'QSet<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qquicklistview.cpp:7272:66: warning: 'QSet<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qquickpositioners.cpp:4033:70: warning: 'QSet<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qquickpositioners.cpp:4034:46: warning: 'QSet<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
tst_qquickpositioners.cpp:4036:66: warning: 'QSet<T> QList<T>::toSet() const [with T = int]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
Change-Id: I9a177f83f07ae5162f7cc231a8c164ba32ffa5bc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto')
6 files changed, 37 insertions, 22 deletions
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<QString> entrySet(const QDir &dir) +{ + const auto &list = dir.entryList(QDir::Files | QDir::NoDotAndDotDot); + return QSet<QString>(list.cbegin(), list.cend()); +} + +static QSet<QString> entrySet(const QDir &dir, const QStringList &filters) +{ + const auto &list = dir.entryList(filters); + return QSet<QString>(list.cbegin(), list.cend()); +} + void tst_qmldiskcache::cacheResources() { - const QSet<QString> existingFiles = - m_qmlCacheDirectory.entryList(QDir::Files | QDir::NoDotAndDotDot).toSet(); + const QSet<QString> existingFiles = entrySet(m_qmlCacheDirectory); QQmlEngine engine; @@ -659,8 +670,7 @@ void tst_qmldiskcache::cacheResources() QCOMPARE(obj->property("value").toInt(), 20); } - const QSet<QString> entries = - m_qmlCacheDirectory.entryList(QDir::NoDotAndDotDot | QDir::Files).toSet().subtract(existingFiles); + const QSet<QString> entries = entrySet(m_qmlCacheDirectory).subtract(existingFiles); QCOMPARE(entries.count(), 1); QDateTime cacheFileTimeStamp; @@ -689,8 +699,7 @@ void tst_qmldiskcache::cacheResources() } { - const QSet<QString> entries = - m_qmlCacheDirectory.entryList(QDir::NoDotAndDotDot | QDir::Files).toSet().subtract(existingFiles); + const QSet<QString> 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<QString> existingFiles = - m_qmlCacheDirectory.entryList(QDir::Files | QDir::NoDotAndDotDot).toSet(); + const QSet<QString> existingFiles = entrySet(m_qmlCacheDirectory); QQmlEngine engine; @@ -936,8 +944,7 @@ void tst_qmldiskcache::cacheModuleScripts() QVERIFY(!compilationUnit->backingFile.isNull()); } - const QSet<QString> entries = - m_qmlCacheDirectory.entryList(QStringList("*.mjsc")).toSet().subtract(existingFiles); + const QSet<QString> 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<QString>::fromList(QQmlMetaType::qmlTypeNames())); + const auto &typeNameList = QQmlMetaType::qmlTypeNames(); + seenTypes.unite(QSet<QString>(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<int> tst_QQuickGridView::toIntList(const QVariantList &list) void tst_QQuickGridView::matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes) { + const QSet<int> expectedIndexSet(expectedIndexes.cbegin(), expectedIndexes.cend()); for (int i=0; i<indexLists.count(); i++) { - QSet<int> current = indexLists[i].value<QList<int> >().toSet(); - if (current != expectedIndexes.toSet()) + const auto ¤tList = indexLists[i].value<QList<int> >(); + const QSet<int> 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<int> tst_QQuickListView::toIntList(const QVariantList &list) void tst_QQuickListView::matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes) { + const QSet<int> expectedIndexSet(expectedIndexes.cbegin(), expectedIndexes.cend()); for (int i=0; i<indexLists.count(); i++) { - QSet<int> current = indexLists[i].value<QList<int> >().toSet(); - if (current != expectedIndexes.toSet()) + const auto ¤tList = indexLists[i].value<QList<int> >(); + const QSet<int> 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<int> &expectedIndexes) { + const QSet<int> expectedIndexSet(expectedIndexes.cbegin(), expectedIndexes.cend()); for (int i=0; i<indexLists.count(); i++) { - QSet<int> current = indexLists[i].value<QList<int> >().toSet(); - if (current != expectedIndexes.toSet()) + const auto ¤tList = indexLists[i].value<QList<int> >(); + const QSet<int> 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<int>(indexes.cbegin(), indexes.cend()) + == QSet<int>(other.indexes.cbegin(), other.indexes.cend()); } bool QQuickViewTestUtil::ListRange::operator!=(const ListRange &other) const |