Skip to content

Commit 5bb5ae4

Browse files
committed
More Qt5 compatibility changes
1 parent cf2e2c8 commit 5bb5ae4

12 files changed

Lines changed: 20 additions & 28 deletions

File tree

examples/CPPPyWrapperExample/CPPPyWrapperExample.pro

Lines changed: 1 addition & 3 deletions
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

examples/PyCPPWrapperExample/PyCPPWrapperExample.pro

Lines changed: 1 addition & 3 deletions
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

examples/PyCustomMetaTypeExample/PyCustomMetaTypeExample.pro

Lines changed: 1 addition & 3 deletions
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

examples/PyDecoratorsExample/PyDecoratorsExample.pro

Lines changed: 1 addition & 3 deletions
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

examples/PyGettingStarted/PyGettingStarted.pro

Lines changed: 1 addition & 3 deletions
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

examples/PyGuiExample/PyGuiExample.pro

Lines changed: 1 addition & 3 deletions
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 )

examples/PyLauncher/PyLauncher.pro

Lines changed: 1 addition & 3 deletions
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 )

examples/PyScriptingConsole/PyScriptingConsole.pro

Lines changed: 1 addition & 3 deletions
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

src/PythonQtClassInfo.cpp

Lines changed: 4 additions & 0 deletions
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

src/PythonQtClassWrapper.cpp

Lines changed: 5 additions & 1 deletion
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

0 commit comments

Comments
 (0)