From 4e89092251bb5c956ac622c14dc8cbd29c68fc3a Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 3 Jan 2023 08:52:01 +0100 Subject: More compile fix with recent Qt 6 Mostly by backporting Creator master hunks. It still compiles with Qt 5.15. Change-Id: I14d2e33c3ca2368cb848748d5f5b41aa47801f72 Reviewed-by: Eike Ziller --- .../qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp | 11 +++++++++++ .../qtcreator/qml/qmlpuppet/qml2puppet/import3d/import3d.cpp | 7 ++++++- .../qml2puppet/instances/qt5informationnodeinstanceserver.cpp | 11 +++++++++-- .../qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp | 5 +++++ src/libs/languageserverprotocol/servercapabilities.cpp | 8 +++++--- src/libs/qmleditorwidgets/easingpane/easinggraph.h | 3 --- src/plugins/clangcodemodel/test/clangautomationutils.h | 1 + src/plugins/cppcheck/cppchecktrigger.h | 1 + src/plugins/debugger/debuggerdialogs.cpp | 10 ++-------- src/plugins/languageclient/locatorfilter.cpp | 2 +- src/plugins/texteditor/quickfix.h | 1 + src/plugins/texteditor/storagesettings.cpp | 2 +- 12 files changed, 43 insertions(+), 19 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp index 4a67141f24..41d389b446 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/selectionboxgeometry.cpp @@ -192,7 +192,11 @@ void SelectionBoxGeometry::doUpdateGeometry() m = targetRN->parent->globalTransform; } rootRN->localTransform = m; +#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) rootRN->markDirty(QSSGRenderNode::TransformDirtyFlag::TransformNotDirty); +#else + rootRN->markDirty(QSSGRenderNode::DirtyFlag::TransformDirty); +#endif rootRN->calculateGlobalVariables(); } else if (!m_spatialNodeUpdatePending) { // Necessary spatial nodes do not yet exist. Defer selection box creation one frame. @@ -236,8 +240,15 @@ void SelectionBoxGeometry::getBounds( if (node != m_targetNode) { if (renderNode) { +#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) if (renderNode->flags.testFlag(QSSGRenderNode::Flag::TransformDirty)) renderNode->calculateLocalTransform(); +#else + if (renderNode->isDirty(QSSGRenderNode::DirtyFlag::TransformDirty)) { + renderNode->localTransform = QSSGRenderNode::calculateTransformMatrix( + node->position(), node->scale(), node->pivot(), node->rotation()); + } +#endif localTransform = renderNode->localTransform; } trackNodeChanges(node); diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/import3d/import3d.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/import3d/import3d.cpp index c1cbca6f5e..a6a0c8085f 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/import3d/import3d.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/import3d/import3d.cpp @@ -50,7 +50,12 @@ void import3D(const QString &sourceAsset, const QString &outDir, int exitId, con if (!optDoc.isNull() && optDoc.isObject()) { QString errorStr; QJsonObject optObj = optDoc.object(); - if (importer->importFile(sourceAsset, outDir, optObj.toVariantMap(), &errorStr) +#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)) + const auto &optionsMap = optObj; +#else + const auto optionsMap = optObj.toVariantMap(); +#endif // QT_VERSION >= 6.4.0 + if (importer->importFile(sourceAsset, outDir, optionsMap, &errorStr) != QSSGAssetImportManager::ImportState::Success) { qWarning() << __FUNCTION__ << "Failed to import 3D asset" << sourceAsset << "with error:" << errorStr; diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 76b3475872..c306600252 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -294,7 +294,14 @@ void Qt5InformationNodeInstanceServer::resolveImportSupport() #ifdef IMPORT_QUICK3D_ASSETS QSSGAssetImportManager importManager; const QHash supportedExtensions = importManager.getSupportedExtensions(); - const QHash supportedOptions = importManager.getAllOptions(); +#if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)) +#define AS_VARIANT_MAP(IT) IT.value().toVariantMap() + using PluginOptionMaps = QSSGAssetImportManager::PluginOptionMaps; +#else +#define AS_VARIANT_MAP(IT) IT.value() + using PluginOptionMaps = QHash; +#endif // QT_VERSION >= 6.4.0 + const PluginOptionMaps supportedOptions = importManager.getAllOptions(); QVariantMap supportMap; @@ -308,7 +315,7 @@ void Qt5InformationNodeInstanceServer::resolveImportSupport() QVariantMap optMap; auto itOpt = supportedOptions.constBegin(); while (itOpt != supportedOptions.constEnd()) { - optMap.insert(itOpt.key(), itOpt.value()); + optMap.insert(itOpt.key(), AS_VARIANT_MAP(itOpt)); ++itOpt; } diff --git a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp index 96997e03d9..3213d50786 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp @@ -556,7 +556,12 @@ bool isSubclassOf(QObject *object, const QByteArray &superTypeName) void getPropertyCache(QObject *object, QQmlEngine *engine) { +#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) QQuickDesignerSupportProperties::getPropertyCache(object, engine); +#else + Q_UNUSED(engine); + QQuickDesignerSupportProperties::getPropertyCache(object); +#endif } void registerNotifyPropertyChangeCallBack(void (*callback)(QObject *, const PropertyName &)) diff --git a/src/libs/languageserverprotocol/servercapabilities.cpp b/src/libs/languageserverprotocol/servercapabilities.cpp index ba8a6836ac..65c37bee59 100644 --- a/src/libs/languageserverprotocol/servercapabilities.cpp +++ b/src/libs/languageserverprotocol/servercapabilities.cpp @@ -342,10 +342,12 @@ bool ServerCapabilities::SemanticHighlightingServerCapabilities::isValid() const { return contains(scopesKey) && value(scopesKey).isArray() && Utils::allOf(value(scopesKey).toArray(), [](const QJsonValue &array) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - return array.isArray() && Utils::allOf(array.toArray(), &QJsonValue::isString); -#else +#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) + return array.isArray() && Utils::allOf(array.toArray(), &QJsonValueConstRef::isString); +#elif QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) return array.isArray() && Utils::allOf(array.toArray(), &QJsonValueRef::isString); +#else + return array.isArray() && Utils::allOf(array.toArray(), &QJsonValue::isString); #endif }); } diff --git a/src/libs/qmleditorwidgets/easingpane/easinggraph.h b/src/libs/qmleditorwidgets/easingpane/easinggraph.h index 517ee7dc1e..b5f1d554e8 100644 --- a/src/libs/qmleditorwidgets/easingpane/easinggraph.h +++ b/src/libs/qmleditorwidgets/easingpane/easinggraph.h @@ -31,9 +31,6 @@ QT_BEGIN_NAMESPACE -QT_MODULE(Declarative) - - class EasingGraph: public QWidget { Q_OBJECT diff --git a/src/plugins/clangcodemodel/test/clangautomationutils.h b/src/plugins/clangcodemodel/test/clangautomationutils.h index dcb62eda76..41c152fffd 100644 --- a/src/plugins/clangcodemodel/test/clangautomationutils.h +++ b/src/plugins/clangcodemodel/test/clangautomationutils.h @@ -27,6 +27,7 @@ #include +#include #include #include diff --git a/src/plugins/cppcheck/cppchecktrigger.h b/src/plugins/cppcheck/cppchecktrigger.h index c2bfc13112..3cd6691de3 100644 --- a/src/plugins/cppcheck/cppchecktrigger.h +++ b/src/plugins/cppcheck/cppchecktrigger.h @@ -26,6 +26,7 @@ #pragma once #include +#include #include namespace Utils { diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 1493b5c686..3b5a222b3d 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -95,14 +95,6 @@ public: QDialogButtonBox *buttonBox; }; -} // namespace Internal -} // namespace Debugger - -Q_DECLARE_METATYPE(Debugger::Internal::StartApplicationParameters) - -namespace Debugger { -namespace Internal { - /////////////////////////////////////////////////////////////////////// // // StartApplicationParameters @@ -944,3 +936,5 @@ void TypeFormatsDialog::addTypeFormats(const QString &type0, } // namespace Internal } // namespace Debugger + +Q_DECLARE_METATYPE(Debugger::Internal::StartApplicationParameters) diff --git a/src/plugins/languageclient/locatorfilter.cpp b/src/plugins/languageclient/locatorfilter.cpp index 11588cc2ad..c87733308f 100644 --- a/src/plugins/languageclient/locatorfilter.cpp +++ b/src/plugins/languageclient/locatorfilter.cpp @@ -89,7 +89,7 @@ void DocumentLocatorFilter::updateSymbols(const DocumentUri &uri, return; QMutexLocker locker(&m_mutex); m_currentSymbols = symbols; - emit symbolsUpToDate({}); + emit symbolsUpToDate(QPrivateSignal()); } void DocumentLocatorFilter::resetSymbols() diff --git a/src/plugins/texteditor/quickfix.h b/src/plugins/texteditor/quickfix.h index 2cc573b53c..61a37d5bfa 100644 --- a/src/plugins/texteditor/quickfix.h +++ b/src/plugins/texteditor/quickfix.h @@ -27,6 +27,7 @@ #include "texteditor_global.h" +#include #include #include #include diff --git a/src/plugins/texteditor/storagesettings.cpp b/src/plugins/texteditor/storagesettings.cpp index 9554fa6e77..54493f923b 100644 --- a/src/plugins/texteditor/storagesettings.cpp +++ b/src/plugins/texteditor/storagesettings.cpp @@ -71,7 +71,7 @@ void StorageSettings::toMap(const QString &prefix, QVariantMap *map) const map->insert(prefix + QLatin1String(addFinalNewLineKey), m_addFinalNewLine); map->insert(prefix + QLatin1String(cleanIndentationKey), m_cleanIndentation); map->insert(prefix + QLatin1String(skipTrailingWhitespaceKey), m_skipTrailingWhitespace); - map->insert(prefix + QLatin1String(ignoreFileTypesKey), m_ignoreFileTypes.toLatin1().data()); + map->insert(prefix + QLatin1String(ignoreFileTypesKey), m_ignoreFileTypes.toLatin1()); } void StorageSettings::fromMap(const QString &prefix, const QVariantMap &map) -- cgit v1.2.1