diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-03 08:34:15 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-03 08:49:05 +0000 |
| commit | 9f0a954cf5a661da3ad6dde3b0ab3ecf32119e29 (patch) | |
| tree | 5b6734fbfb9ef2d18878ba7bd8f0d22778aea592 | |
| parent | 347a32255a2e8e3c6d73b94b1cfe74fddbe09aad (diff) | |
Remove most QT_VERSION checks
As a drive by, adapt to changed values of QMetaObject::Call.
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: Ic55a5da910c9ef022af3dedf749f80153f519ebf
Reviewed-by: Christian Tismer <tismer@stackless.com>
10 files changed, 2 insertions, 79 deletions
diff --git a/sources/pyside2/libpyside/globalreceiverv2.cpp b/sources/pyside2/libpyside/globalreceiverv2.cpp index b1e75ad8e..bfaa9ff44 100644 --- a/sources/pyside2/libpyside/globalreceiverv2.cpp +++ b/sources/pyside2/libpyside/globalreceiverv2.cpp @@ -276,11 +276,7 @@ int GlobalReceiverV2::refCount(const QObject *link) const void GlobalReceiverV2::notify() { -#if QT_VERSION >= 0x050E00 const QSet<const QObject *> objSet(m_refs.cbegin(), m_refs.cend()); -#else - const auto objSet = QSet<const QObject *>::fromList(m_refs); -#endif Py_BEGIN_ALLOW_THREADS for (const QObject *o : objSet) { QMetaObject::disconnect(o, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID); diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp index 85db745ae..f169c63e1 100644 --- a/sources/pyside2/libpyside/pysideproperty.cpp +++ b/sources/pyside2/libpyside/pysideproperty.cpp @@ -139,17 +139,8 @@ static void qpropertyMetaCall(PySideProperty *pp, PyObject *self, QMetaObject::C break; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - case QMetaObject::RegisterQPropertyObserver: - case QMetaObject::SetQPropertyBinding: -#else - case QMetaObject::QueryPropertyDesignable: - case QMetaObject::QueryPropertyScriptable: - case QMetaObject::QueryPropertyStored: - case QMetaObject::QueryPropertyEditable: - case QMetaObject::QueryPropertyUser: // just to avoid gcc warnings -#endif + case QMetaObject::BindableProperty: case QMetaObject::InvokeMetaMethod: case QMetaObject::CreateInstance: case QMetaObject::IndexOfMethod: diff --git a/sources/pyside2/libpyside/signalmanager.cpp b/sources/pyside2/libpyside/signalmanager.cpp index 69ee67932..0992cfcfd 100644 --- a/sources/pyside2/libpyside/signalmanager.cpp +++ b/sources/pyside2/libpyside/signalmanager.cpp @@ -66,9 +66,6 @@ #include <private/qv4engine_p.h> #include <private/qv4context_p.h> #include <private/qqmldata_p.h> -#if QT_VERSION < 0x050700 - #include <private/qqmlcontextwrapper_p.h> -#endif #endif #if QSLOT_CODE != 1 || QSIGNAL_CODE != 2 @@ -396,13 +393,6 @@ int SignalManager::qt_metacall(QObject *object, QMetaObject::Call call, int id, case QMetaObject::ReadProperty: case QMetaObject::WriteProperty: case QMetaObject::ResetProperty: -# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - case QMetaObject::QueryPropertyDesignable: - case QMetaObject::QueryPropertyScriptable: - case QMetaObject::QueryPropertyStored: - case QMetaObject::QueryPropertyEditable: - case QMetaObject::QueryPropertyUser: -# endif // < Qt 6 pp->d->metaCallHandler(pp, pySelf, call, args); break; #endif @@ -441,15 +431,7 @@ int SignalManager::qt_metacall(QObject *object, QMetaObject::Call call, int id, if (data && !data->jsWrapper.isNullOrUndefined()) { QV4::ExecutionEngine *engine = data->jsWrapper.engine(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) if (engine->currentStackFrame != nullptr) { -#elif QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) - if (engine->currentContext->d() != engine->rootContext()->d()) { -#else - QV4::ExecutionContext *ctx = engine->currentContext(); - if (ctx->type == QV4::Heap::ExecutionContext::Type_CallContext || - ctx->type == QV4::Heap::ExecutionContext::Type_SimpleCallContext) { -#endif PyObject *errType, *errValue, *errTraceback; PyErr_Fetch(&errType, &errValue, &errTraceback); // PYSIDE-464: The error is only valid before PyErr_Restore, @@ -462,7 +444,6 @@ int SignalManager::qt_metacall(QObject *object, QMetaObject::Call call, int id, PyErr_Print(); // Note: PyErr_Print clears the error. -#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) if (isSyntaxError) { return engine->throwSyntaxError(errString); } else if (isTypeError) { @@ -470,18 +451,9 @@ int SignalManager::qt_metacall(QObject *object, QMetaObject::Call call, int id, } else { return engine->throwError(errString); } -#else - if (isSyntaxError) { - return ctx->throwSyntaxError(errString); - } else if (isTypeError) { - return ctx->throwTypeError(errString); - } else { - return ctx->throwError(errString); - } -#endif } } -#endif +#endif // PYSIDE_QML_PRIVATE_API_SUPPORT int reclimit = Py_GetRecursionLimit(); // Inspired by Python's errors.c: PyErr_GivenExceptionMatches() function. diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp index b3159443e..c8565d44a 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp @@ -1474,11 +1474,7 @@ void AbstractMetaBuilderPrivate::traverseEnums(const ScopeModelItem &scopeItem, const QStringList &enumsDeclarations) { const EnumList &enums = scopeItem->enums(); -#if QT_VERSION >= 0x050E00 const QSet<QString> enumsDeclarationSet(enumsDeclarations.cbegin(), enumsDeclarations.cend()); -#else - const QSet<QString> enumsDeclarationSet = QSet<QString>::fromList(enumsDeclarations); -#endif for (const EnumModelItem &enumItem : enums) { AbstractMetaEnum* metaEnum = traverseEnum(enumItem, metaClass, enumsDeclarationSet); if (metaEnum) { diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp index 6452a251a..8b24a49e1 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp @@ -1340,16 +1340,12 @@ QDebug operator<<(QDebug d, const AbstractMetaFunction *af) d.nospace(); d << "AbstractMetaFunction("; if (af) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) if (d.verbosity() > 2) { af->formatDebugVerbose(d); } else { -#endif d << "signature="; formatMetaFunctionBrief(d, af); -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) } -#endif } else { d << '0'; } diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp index 579650f0d..e134ebcfe 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp @@ -44,10 +44,6 @@ #include <cstring> #include <ctype.h> -#if QT_VERSION < 0x050800 -# define Q_FALLTHROUGH() (void)0 -#endif - namespace clang { static inline QString colonColon() { return QStringLiteral("::"); } diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp index 071eb3bde..659324f8c 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp @@ -357,16 +357,7 @@ QByteArrayList emulatedCompilerOptions() LanguageLevel emulatedCompilerLanguageLevel() { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) return LanguageLevel::Cpp17; -#else -# if defined(Q_CC_MSVC) && _MSC_VER > 1900 - // Fixes constexpr errors in MSVC2017 library headers with Clang 4.1..5.X (0.45 == Clang 6). - if (libClangVersion() < QVersionNumber(0, 45)) - return LanguageLevel::Cpp1Z; -# endif // Q_CC_MSVC && _MSC_VER > 1900 - return LanguageLevel::Cpp14; // otherwise, t.h is parsed as "C" -#endif // Qt 5 } struct LanguageLevelMapping diff --git a/sources/shiboken2/ApiExtractor/fileout.cpp b/sources/shiboken2/ApiExtractor/fileout.cpp index ba5bf19de..10b9747ab 100644 --- a/sources/shiboken2/ApiExtractor/fileout.cpp +++ b/sources/shiboken2/ApiExtractor/fileout.cpp @@ -30,9 +30,6 @@ #include "messages.h" #include "reporthandler.h" -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -# include <QtCore/QTextCodec> -#endif #include <QtCore/QFileInfo> #include <QtCore/QDir> #include <QtCore/QDebug> @@ -221,10 +218,6 @@ FileOut::State FileOut::done(QString *errorMessage) *errorMessage = msgCannotOpenForWriting(fileWrite); return Failure; } -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QTextCodec *codec = QTextCodec::codecForName("UTF-8"); - stream.setCodec(codec); -#endif stream.setDevice(&fileWrite); stream << tmp; } diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp index 5f6bcbaff..76ce333ed 100644 --- a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp +++ b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp @@ -494,11 +494,7 @@ void TypeInfo::formatDebug(QDebug &d) const QDebug operator<<(QDebug d, const TypeInfo &t) { QDebugStateSaver s(d); -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) const int verbosity = d.verbosity(); -#else - const int verbosity = 0; -#endif d.noquote(); d.nospace(); d << "TypeInfo("; diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 59187e454..f0c6398ee 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -842,11 +842,7 @@ QString CppGenerator::virtualMethodReturn(QTextStream &s, const QRegularExpressionMatch match = regex.match(expr, offset); if (!match.hasMatch()) break; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) const int argId = match.capturedView(1).toInt() - 1; -#else - const int argId = match.capturedRef(1).toInt() - 1; -#endif if (argId < 0 || argId > func->arguments().count()) { qCWarning(lcShiboken, "The expression used in return value contains an invalid index."); break; |
