Skip to content

Fix problems in Qt5.11 generator #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 19 additions & 33 deletions build/common.prf
Original file line number Diff line number Diff line change
Expand Up @@ -25,50 +25,36 @@ PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_$${QT_MAJOR_VERSION}$${QT_MINOR_VERSION}

!exists($$PYTHONQT_GENERATED_PATH) {
contains( QT_MAJOR_VERSION, 5 ) {
contains( QT_MINOR_VERSION, 10 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else:contains( QT_MINOR_VERSION, 11 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_511
}
else:contains( QT_MINOR_VERSION, 12 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_511
}
else:contains( QT_MINOR_VERSION, 1 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_50
}
else:contains( QT_MINOR_VERSION, 2 ) {
# For Qt5 we know that the older generated wrappers work with the later
# versions, even (apparently) Qt5.15, so:
equals(QT_MAJOR_VERSION, 5) {
# Qt5: have 5.0, 5.3, 5.4, 5.6 and 5.11 at present:
lessThan(QT_MINOR_VERSION, 3) { # 5.1, 5.2
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_50
}
else:contains( QT_MINOR_VERSION, 3 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_53
}
else:contains( QT_MINOR_VERSION, 4 ) {
else: lessThan(QT_MINOR_VERSION, 6) { # 5.5
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_54
}
else:contains( QT_MINOR_VERSION, 5 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_54
}
else:contains( QT_MINOR_VERSION, 6 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else:contains( QT_MINOR_VERSION, 7 ) {
else: lessThan(QT_MINOR_VERSION, 11) { # 5.7, 5.8, 5.9, 5.10
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else:contains( QT_MINOR_VERSION, 8 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else:contains( QT_MINOR_VERSION, 9 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
else { # >5.11
# LATEST Qt5 generated files:
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_511
}
}

!exists($$PYTHONQT_GENERATED_PATH) {
error("No generated sources exist for Qt$${QT_VERSION}")
}
}
}

!build_pass {
message("Qt version: Qt$${QT_VERSION}")
message("Using generated sources files from $${PYTHONQT_GENERATED_PATH}")
}

VERSION = 3.2.0
win32: CONFIG += skip_target_version_ext
gcc|win32-clang-msvc:QMAKE_CXXFLAGS += -Wno-deprecated-declarations -Wuninitialized -Winit-self -pedantic
Expand Down
31 changes: 25 additions & 6 deletions generator/qtscript_masterinclude.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
** $QT_END_LICENSE$
**
****************************************************************************/

// We need to force the endianess in Qt5
#define Q_BYTE_ORDER Q_LITTLE_ENDIAN

Expand All @@ -48,11 +47,31 @@
#define QOPENGLFUNCTIONS_H
#define QOPENGLEXTRAFUNCTIONS_H

// our compiler can't handle the templates for singleShot (int Qt 5.12), but we can circumvent this with
// Q_CLANG_QDOC for the moment:
#define Q_CLANG_QDOC
#include <QtCore/QTimer>
#undef Q_CLANG_QDOC
/* This must only be included after 'QT_NO_' definitions have been defined. */
#include <QtCore/qglobal.h>

/* NOTE: Qt5.12 and later (including Qt6) uses template functions for the
* static implementations of QTimer::singleShot() (the function, not the
* property). The generator does not handle template functions. Defining
* Q_CLANG_QDOC works around this by exposing the non-template forms that
* appear in the documentation at the same time as hiding the templates.
* Without this the QTimer::singleShot functions do not appear in the PythonQt
* interface.
*
* Unfortunately the work around breaks precompilation in Qt5.11 because it
* causes duplicate definitions of some text handling functions (they really
* are duplicated if Q_CLANG_QDOC is turned on) so the change must be version
* specific.
*
* This does not work in Qt6 because Qt6 uses Q_QDOC for the documentation and
* needs other fixes.
*/
#if QT_VERSION_MAJOR == 5 && QT_VERSION_MINOR > 11
# include <QtCore/QObject> // included by QtCore/QTimer
# define Q_CLANG_QDOC
# include <QtCore/QTimer>
# undef Q_CLANG_QDOC
#endif

#include <QtCore/QtCore>
#include <QtGui/QtGui>
Expand Down