Skip to content

Commit a047d41

Browse files
mrbean-bremenjcfr
authored andcommitted
[Backport] More Qt5 compatibility changes
(cherry picked from commit MeVisLab/pythonqt@5bb5ae4)
1 parent aabe33f commit a047d41

File tree

12 files changed

+20
-28
lines changed

12 files changed

+20
-28
lines changed

Diff for: examples/CPPPyWrapperExample/CPPPyWrapperExample.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ DESTDIR = ../../lib
99
include ( ../../build/common.prf )
1010
include ( ../../build/PythonQt.prf )
1111

12-
contains(QT_MAJOR_VERSION, 5) {
13-
QT += widgets
14-
}
12+
QT += widgets
1513

1614
SOURCES += \
1715
CPPPyWrapperExample.cpp

Diff for: examples/PyCPPWrapperExample/PyCPPWrapperExample.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ DESTDIR = ../../lib
1212
include ( ../../build/common.prf )
1313
include ( ../../build/PythonQt.prf )
1414

15-
contains(QT_MAJOR_VERSION, 5) {
16-
QT += widgets
17-
}
15+
QT += widgets
1816

1917
HEADERS += \
2018
CustomObjects.h

Diff for: examples/PyCustomMetaTypeExample/PyCustomMetaTypeExample.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ DESTDIR = ../../lib
1212
include ( ../../build/common.prf )
1313
include ( ../../build/PythonQt.prf )
1414

15-
contains(QT_MAJOR_VERSION, 5) {
16-
QT += widgets
17-
}
15+
QT += widgets
1816

1917
HEADERS += \
2018
CustomObject.h

Diff for: examples/PyDecoratorsExample/PyDecoratorsExample.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ DESTDIR = ../../lib
1212
include ( ../../build/common.prf )
1313
include ( ../../build/PythonQt.prf )
1414

15-
contains(QT_MAJOR_VERSION, 5) {
16-
QT += widgets
17-
}
15+
QT += widgets
1816

1917
HEADERS += \
2018
PyExampleDecorators.h

Diff for: examples/PyGettingStarted/PyGettingStarted.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ CONFIG += console
1414
include ( ../../build/common.prf )
1515
include ( ../../build/PythonQt.prf )
1616

17-
contains(QT_MAJOR_VERSION, 5) {
18-
QT += widgets
19-
}
17+
QT += widgets
2018

2119
SOURCES += \
2220
main.cpp

Diff for: examples/PyGuiExample/PyGuiExample.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ mac:CONFIG -= app_bundle
1111

1212
DESTDIR = ../../lib
1313

14-
contains(QT_MAJOR_VERSION, 5) {
15-
QT += widgets
16-
}
14+
QT += widgets
1715

1816
include ( ../../build/common.prf )
1917
include ( ../../build/PythonQt.prf )

Diff for: examples/PyLauncher/PyLauncher.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ mac:CONFIG -= app_bundle
1111

1212
DESTDIR = ../../lib
1313

14-
contains(QT_MAJOR_VERSION, 5) {
15-
QT += widgets
16-
}
14+
QT += widgets
1715

1816
include ( ../../build/common.prf )
1917
include ( ../../build/PythonQt.prf )

Diff for: examples/PyScriptingConsole/PyScriptingConsole.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ include ( ../../build/common.prf )
1515
include ( ../../build/PythonQt.prf )
1616
include ( ../../build/PythonQt_QtAll.prf )
1717

18-
contains(QT_MAJOR_VERSION, 5) {
19-
QT += widgets
20-
}
18+
QT += widgets
2119

2220
HEADERS += \
2321
PyExampleObject.h

Diff for: src/PythonQtClassInfo.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,12 @@ QStringList PythonQtClassInfo::memberList()
554554
}
555555
}
556556

557+
#if QT_VERSION >= 0x060000
557558
QSet<QString> set(l.begin(), l.end());
558559
return set.values();
560+
#else
561+
return QSet<QString>::fromList(l).toList();
562+
#endif
559563
}
560564

561565
const QByteArray& PythonQtClassInfo::className() const

Diff for: src/PythonQtClassWrapper.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,13 @@ static PyObject *PythonQtClassWrapper_getattro(PyObject *obj, PyObject *name)
465465

466466
auto members = wrapper->classInfo()->memberList();
467467
auto properties = wrapper->classInfo()->propertyList();
468+
#if QT_VERSION >= 0x060000
468469
QSet<QString> completeSet(members.begin(), members.end());
469470
completeSet.unite(QSet<QString>(properties.begin(), properties.end()));
470-
471+
#else
472+
QSet<QString> completeSet = QSet<QString>::fromList(members);
473+
completeSet.unite(QSet<QString>::fromList(properties));
474+
#endif
471475
Q_FOREACH (QString name, completeSet) {
472476
if (name.startsWith("py_")) {
473477
// do not expose internal slots

Diff for: src/src.pro

+2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ QT += widgets core-private
3434
INCLUDEPATH += $$PWD
3535

3636
macx {
37+
contains(QT_MAJOR_VERSION, 6) {
3738
QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
39+
}
3840
}
3941

4042
include ( ../build/common.prf )

Diff for: tests/tests.pro

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ DEFINES += QT_NO_CAST_TO_ASCII
1919

2020
gcc: QMAKE_CXXFLAGS += -pedantic -ansi -Winit-self -Wuninitialized
2121

22-
contains(QT_MAJOR_VERSION, 5) {
23-
QT += widgets
24-
}
22+
QT += widgets
2523

2624
include ( ../build/common.prf )
2725
include ( ../build/PythonQt.prf )

0 commit comments

Comments
 (0)