From cebd1e38ad803f059327b687e8ffbd4c497dfe09 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 30 Jan 2024 20:10:23 -0500 Subject: [PATCH] fix: Address warnings with QSet::fromList in Qt 5.15 Starting with Qt 5.15, the conversion functions between QList and QSet (e.g., `QSet::fromList`) have been deprecated in favor of range constructors. This change updates the code to use the new range constructors to avoid deprecation warnings starting from Qt 5.14 (instead of Qt 6) Related upstream Qt commits: * qt/qtbase@92f984273 ("Deprecate conversion functions between QList and QSet", 2019-05-07) * qt/qtbase@e59e5643b ("Use QT_DEPRECATED_X instead of Q_DECL_DEPRECATED_X", 2020-02-25) (cherry picked from commit commontk/PythonQt@630e376670b4da094c0ecec37335aaffd6a2e81a) --- src/PythonQtClassInfo.cpp | 2 +- src/PythonQtClassWrapper.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PythonQtClassInfo.cpp b/src/PythonQtClassInfo.cpp index 9e4524a6a..b730e982d 100644 --- a/src/PythonQtClassInfo.cpp +++ b/src/PythonQtClassInfo.cpp @@ -562,7 +562,7 @@ QStringList PythonQtClassInfo::memberList() } } -#if QT_VERSION >= 0x060000 +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) QSet set(l.begin(), l.end()); return set.values(); #else diff --git a/src/PythonQtClassWrapper.cpp b/src/PythonQtClassWrapper.cpp index f8ca3febe..aaa6d84f4 100644 --- a/src/PythonQtClassWrapper.cpp +++ b/src/PythonQtClassWrapper.cpp @@ -477,7 +477,7 @@ static PyObject *PythonQtClassWrapper_getattro(PyObject *obj, PyObject *name) auto members = wrapper->classInfo()->memberList(); auto properties = wrapper->classInfo()->propertyList(); -#if QT_VERSION >= 0x060000 +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) QSet completeSet(members.begin(), members.end()); completeSet.unite(QSet(properties.begin(), properties.end())); #else