diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-01-07 09:45:21 +0200 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-01-21 16:45:14 +0200 |
commit | 682271c9e62e58d48b7e4d17761aade3465ca4d8 (patch) | |
tree | 7e35071847fddaac547faba32e1550cd82ae3599 | |
parent | b789cfdd4fb7a833e426072393a4cb23328a1641 (diff) |
Fix a set of compilation errors against Qt6
Fixes include
-qmllistproperty uses qsizetype instead of int
-implicit constructor calls that Qt6 marks as explicit
-QEnableIf removed => std::enable_if
-Replace the removed QCoreApplicationPrivate::cloneEvent()
-Conflicting forward declaration for QStringList (comes via qglobal.h)
N.B. after this task the generated (by generator.cpp) code won’t still
compile, and it likely requires more in-depth study how to fix it
=> looks like they relate to the Qt6 property system changes. By
temporarily disabling the violating generated code all unit tests pass
though => needs a followup task to analyze and fix.
Task-number: QTBUG-89832
Change-Id: I9f7d1cd5898b549f243a7df464ca124d29074c46
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r-- | src/imports/statemachine/childrenprivate.h | 6 | ||||
-rw-r--r-- | src/scxml/qscxmlcompiler.cpp | 2 | ||||
-rw-r--r-- | src/scxml/qscxmlstatemachine.cpp | 8 | ||||
-rw-r--r-- | src/scxml/qscxmlstatemachine.h | 16 | ||||
-rw-r--r-- | src/statemachine/qstatemachine.cpp | 7 | ||||
-rw-r--r-- | tests/auto/scion/tst_scion.cpp | 2 | ||||
-rw-r--r-- | tools/qscxmlc/generator.cpp | 2 | ||||
-rw-r--r-- | tools/qscxmlc/qscxmlc.h | 1 |
8 files changed, 20 insertions, 24 deletions
diff --git a/src/imports/statemachine/childrenprivate.h b/src/imports/statemachine/childrenprivate.h index 2dcecd6..8eab308 100644 --- a/src/imports/statemachine/childrenprivate.h +++ b/src/imports/statemachine/childrenprivate.h @@ -141,12 +141,12 @@ public: emit parentObject<T>(prop)->childrenChanged(); } - static int count(QQmlListProperty<QObject> *prop) + static qsizetype count(QQmlListProperty<QObject> *prop) { return static_cast<Self *>(prop->data)->children.count(); } - static QObject *at(QQmlListProperty<QObject> *prop, int index) + static QObject *at(QQmlListProperty<QObject> *prop, qsizetype index) { return static_cast<Self *>(prop->data)->children.at(index); } @@ -161,7 +161,7 @@ public: emit parentObject<T>(prop)->childrenChanged(); } - static void replace(QQmlListProperty<QObject> *prop, int index, QObject *item) + static void replace(QQmlListProperty<QObject> *prop, qsizetype index, QObject *item) { auto &children = static_cast<Self *>(prop->data)->children; diff --git a/src/scxml/qscxmlcompiler.cpp b/src/scxml/qscxmlcompiler.cpp index 60e7197..687d255 100644 --- a/src/scxml/qscxmlcompiler.cpp +++ b/src/scxml/qscxmlcompiler.cpp @@ -2451,7 +2451,7 @@ QByteArray QScxmlCompilerPrivate::DefaultLoader::load(const QString &name, const const QUrl url(name); if (!url.isLocalFile() && !url.isRelative()) errs << QStringLiteral("src attribute is not a local file (%1)").arg(name); - QFileInfo fInfo = url.isLocalFile() ? url.toLocalFile() : name; + QFileInfo fInfo(url.isLocalFile() ? url.toLocalFile() : name); #endif // BUILD_QSCXMLC if (fInfo.isRelative()) fInfo = QFileInfo(QDir(baseDir).filePath(fInfo.filePath())); diff --git a/src/scxml/qscxmlstatemachine.cpp b/src/scxml/qscxmlstatemachine.cpp index e5967f8..8a0ed25 100644 --- a/src/scxml/qscxmlstatemachine.cpp +++ b/src/scxml/qscxmlstatemachine.cpp @@ -114,7 +114,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn template<typename Functor> typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::Type QScxmlStateMachine::connectToEvent( + \fn template<typename Functor> typename std::enable_if<!QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::type QScxmlStateMachine::connectToEvent( const QString &scxmlEventSpec, Functor functor, Qt::ConnectionType type) @@ -133,7 +133,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn template<typename Functor> typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::Type QScxmlStateMachine::connectToEvent( + \fn template<typename Functor> typename std::enable_if<!QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::type QScxmlStateMachine::connectToEvent( const QString &scxmlEventSpec, const QObject *context, Functor functor, @@ -169,7 +169,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn template<typename Functor> typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::Type QScxmlStateMachine::connectToState( + \fn template<typename Functor> typename std::enable_if<!QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::type QScxmlStateMachine::connectToState( const QString &scxmlStateName, Functor functor, Qt::ConnectionType type) @@ -184,7 +184,7 @@ Q_LOGGING_CATEGORY(scxmlLog, "scxml.statemachine") */ /*! - \fn template<typename Functor> typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::Type QScxmlStateMachine::connectToState( + \fn template<typename Functor> typename std::enable_if<!QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::type QScxmlStateMachine::connectToState( const QString &scxmlStateName, const QObject *context, Functor functor, diff --git a/src/scxml/qscxmlstatemachine.h b/src/scxml/qscxmlstatemachine.h index f875860..fbcbf12 100644 --- a/src/scxml/qscxmlstatemachine.h +++ b/src/scxml/qscxmlstatemachine.h @@ -132,9 +132,9 @@ public: // connect state to a functor or function pointer (without context) template <typename Functor> - inline typename QtPrivate::QEnableIf< + inline typename std::enable_if< !QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && - !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::Type + !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::type connectToState(const QString &scxmlStateName, Functor functor, Qt::ConnectionType type = Qt::AutoConnection) { @@ -144,9 +144,9 @@ public: // connectToState to a functor or function pointer (with context) template <typename Functor> - inline typename QtPrivate::QEnableIf< + inline typename std::enable_if< !QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && - !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::Type + !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::type connectToState(const QString &scxmlStateName, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection) { @@ -240,9 +240,9 @@ public: // connect state to a functor or function pointer (without context) template <typename Functor> - inline typename QtPrivate::QEnableIf< + inline typename std::enable_if< !QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && - !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::Type + !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::type connectToEvent(const QString &scxmlEventSpec, Functor functor, Qt::ConnectionType type = Qt::AutoConnection) { @@ -252,9 +252,9 @@ public: // connectToEvent to a functor or function pointer (with context) template <typename Functor> - inline typename QtPrivate::QEnableIf< + inline typename std::enable_if< !QtPrivate::FunctionPointer<Functor>::IsPointerToMemberFunction && - !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::Type + !std::is_same<const char*, Functor>::value, QMetaObject::Connection>::type connectToEvent(const QString &scxmlEventSpec, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection) { diff --git a/src/statemachine/qstatemachine.cpp b/src/statemachine/qstatemachine.cpp index 2733b87..e42a087 100644 --- a/src/statemachine/qstatemachine.cpp +++ b/src/statemachine/qstatemachine.cpp @@ -2410,11 +2410,8 @@ void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transitio void QStateMachinePrivate::handleFilteredEvent(QObject *watched, QEvent *event) { - auto *tmp = QCoreApplication::instance(); - auto *app = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(tmp)); - - if (app && qobjectEvents.value(watched).contains(event->type())) { - postInternalEvent(new QStateMachine::WrappedEvent(watched, app->cloneEvent(event))); + if (qobjectEvents.value(watched).contains(event->type())) { + postInternalEvent(new QStateMachine::WrappedEvent(watched, event->clone())); processEvents(DirectProcessing); } } diff --git a/tests/auto/scion/tst_scion.cpp b/tests/auto/scion/tst_scion.cpp index d1e4873..70b649c 100644 --- a/tests/auto/scion/tst_scion.cpp +++ b/tests/auto/scion/tst_scion.cpp @@ -109,7 +109,7 @@ QByteArray DynamicLoader::load(const QString &name, QUrl url(name); if (!url.isLocalFile() && !url.isRelative()) errs << QStringLiteral("src attribute is not a local file (%1)").arg(name); - QFileInfo fInfo = url.isLocalFile() ? url.toLocalFile() : name; + QFileInfo fInfo(url.isLocalFile() ? url.toLocalFile() : name); if (fInfo.isRelative()) fInfo = QFileInfo(QDir(baseDir).filePath(fInfo.filePath())); fInfo = QFileInfo(QLatin1String(":/") + fInfo.filePath()); // take it from resources diff --git a/tools/qscxmlc/generator.cpp b/tools/qscxmlc/generator.cpp index a767872..dfedb3b 100644 --- a/tools/qscxmlc/generator.cpp +++ b/tools/qscxmlc/generator.cpp @@ -463,7 +463,7 @@ void Generator::generateCode() // Build extra array // QList<QByteArray> extraList; - QMultiHash<QByteArray, QByteArray> knownExtraMetaObject = knownGadgets; + QMultiHash<QByteArray, QByteArray> knownExtraMetaObject(knownGadgets); knownExtraMetaObject.unite(knownQObjectClasses); for (int i = 0; i < cdef->propertyList.count(); ++i) { diff --git a/tools/qscxmlc/qscxmlc.h b/tools/qscxmlc/qscxmlc.h index 81c2427..a909bfe 100644 --- a/tools/qscxmlc/qscxmlc.h +++ b/tools/qscxmlc/qscxmlc.h @@ -43,7 +43,6 @@ #include <QtCore/qglobal.h> QT_BEGIN_NAMESPACE -class QStringList; int run(const QStringList &arguments); |