diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.h b/share/qtcreator/templates/wizards/classes/cpp/file.h index df35bd553c2..77f1b213516 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/file.h +++ b/share/qtcreator/templates/wizards/classes/cpp/file.h @@ -32,6 +32,9 @@ class %{CN} @if '%{AddQObjectMacro}' Q_OBJECT @endif +@if '%{AddQmlElementMacro}' + QML_ELEMENT +@endif public: @if '%{Base}' === 'QObject' || %{JS: Cpp.hasQObjectParent('%{Base}')} explicit %{CN}(QObject *parent = nullptr); diff --git a/share/qtcreator/templates/wizards/classes/cpp/wizard.json b/share/qtcreator/templates/wizards/classes/cpp/wizard.json index 33ba82355a9..9317c175981 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/wizard.json +++ b/share/qtcreator/templates/wizards/classes/cpp/wizard.json @@ -146,6 +146,17 @@ "checked": "%{JS: [ 'QObject', 'QWidget', 'QMainWindow', 'QDeclarativeItem', 'QQuickItem'].indexOf(value('Base')) >= 0 }" } }, + { + "name": "AddQmlElementMacro", + "trDisplayName": "Add QML_ELEMENT", + "type": "CheckBox", + "data": + { + "checkedValue": "AddQmlElementMacro", + "uncheckedValue": "", + "checked": "%{JS: ['QQuickItem'].indexOf(value('Base')) >= 0 }" + } + }, { "name": "Sp2", "type": "Spacer" diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/file.pro b/share/qtcreator/templates/wizards/projects/consoleapp/file.pro index 8cafd79b8b8..d86283e2dfb 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/file.pro +++ b/share/qtcreator/templates/wizards/projects/consoleapp/file.pro @@ -1,7 +1,6 @@ -QT -= gui +QT = core -CONFIG += c++17 console -CONFIG -= app_bundle +CONFIG += c++17 cmdline # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp index effaac4b65a..7f10c79428c 100644 --- a/src/libs/3rdparty/cplusplus/Bind.cpp +++ b/src/libs/3rdparty/cplusplus/Bind.cpp @@ -915,6 +915,10 @@ OperatorNameId::Kind Bind::cppOperator(OperatorAST *ast) kind = OperatorNameId::ArrayAccessOp; break; + case T_LESS_EQUAL_GREATER: + kind = OperatorNameId::SpaceShipOp; + break; + default: kind = OperatorNameId::InvalidOp; } // switch diff --git a/src/libs/3rdparty/cplusplus/Lexer.cpp b/src/libs/3rdparty/cplusplus/Lexer.cpp index 8e1f7e2899e..e2f1b4e0e6b 100644 --- a/src/libs/3rdparty/cplusplus/Lexer.cpp +++ b/src/libs/3rdparty/cplusplus/Lexer.cpp @@ -612,7 +612,12 @@ void Lexer::scan_helper(Token *tok) tok->f.kind = T_LESS_LESS; } else if (_yychar == '=') { yyinp(); - tok->f.kind = T_LESS_EQUAL; + if (_languageFeatures.cxx20Enabled && _yychar == '>') { + yyinp(); + tok->f.kind = T_LESS_EQUAL_GREATER; + } else { + tok->f.kind = T_LESS_EQUAL; + } } else if (_yychar == ':') { if (*(_currentChar+1) != ':' || *(_currentChar+2) == ':' || *(_currentChar+2) == '>') { yyinp(); diff --git a/src/libs/3rdparty/cplusplus/Names.h b/src/libs/3rdparty/cplusplus/Names.h index 7913c9b0bc2..ede94eb7814 100644 --- a/src/libs/3rdparty/cplusplus/Names.h +++ b/src/libs/3rdparty/cplusplus/Names.h @@ -180,7 +180,7 @@ public: ! = < > += -= *= /= %= ^= &= |= << >> >>= <<= == != <= >= && || ++ -- , ->* -> - () [] + () [] <=> */ enum Kind { InvalidOp, @@ -225,7 +225,8 @@ public: ArrowStarOp, ArrowOp, FunctionCallOp, - ArrayAccessOp + ArrayAccessOp, + SpaceShipOp }; public: diff --git a/src/libs/3rdparty/cplusplus/Parser.cpp b/src/libs/3rdparty/cplusplus/Parser.cpp index 430b19efbe4..cb7bfa3a1b6 100644 --- a/src/libs/3rdparty/cplusplus/Parser.cpp +++ b/src/libs/3rdparty/cplusplus/Parser.cpp @@ -98,10 +98,11 @@ enum { And = 8, Equality = 9, Relational = 10, - Shift = 11, - Additive = 12, - Multiplicative = 13, - PointerToMember = 14 + ThreeWayComp = 11, + Shift = 12, + Additive = 13, + Multiplicative = 14, + PointerToMember = 15 }; } // namespace Precedece @@ -116,29 +117,30 @@ inline int precedence(int tokenKind, bool templateArguments) return Prec::Assignment; switch (tokenKind) { - case T_COMMA: return Prec::Comma; - case T_QUESTION: return Prec::Conditional; - case T_PIPE_PIPE: return Prec::LogicalOr; - case T_AMPER_AMPER: return Prec::LogicalAnd; - case T_PIPE: return Prec::InclusiveOr; - case T_CARET: return Prec::ExclusiveOr; - case T_AMPER: return Prec::And; + case T_COMMA: return Prec::Comma; + case T_QUESTION: return Prec::Conditional; + case T_PIPE_PIPE: return Prec::LogicalOr; + case T_AMPER_AMPER: return Prec::LogicalAnd; + case T_PIPE: return Prec::InclusiveOr; + case T_CARET: return Prec::ExclusiveOr; + case T_AMPER: return Prec::And; case T_EQUAL_EQUAL: - case T_EXCLAIM_EQUAL: return Prec::Equality; + case T_EXCLAIM_EQUAL: return Prec::Equality; case T_GREATER: case T_LESS: case T_LESS_EQUAL: - case T_GREATER_EQUAL: return Prec::Relational; + case T_GREATER_EQUAL: return Prec::Relational; + case T_LESS_EQUAL_GREATER: return Prec::ThreeWayComp; case T_LESS_LESS: - case T_GREATER_GREATER: return Prec::ExclusiveOr; + case T_GREATER_GREATER: return Prec::ExclusiveOr; case T_PLUS: - case T_MINUS: return Prec::Additive; + case T_MINUS: return Prec::Additive; case T_STAR: case T_SLASH: - case T_PERCENT: return Prec::Multiplicative; + case T_PERCENT: return Prec::Multiplicative; case T_ARROW_STAR: - case T_DOT_STAR: return Prec::PointerToMember; - default: return Prec::Unknown; + case T_DOT_STAR: return Prec::PointerToMember; + default: return Prec::Unknown; } } @@ -1300,6 +1302,7 @@ bool Parser::parseOperator(OperatorAST *&node) // ### FIXME case T_GREATER_EQUAL: case T_GREATER_GREATER_EQUAL: case T_LESS_EQUAL: + case T_LESS_EQUAL_GREATER: case T_LESS_LESS_EQUAL: case T_MINUS_EQUAL: case T_PERCENT_EQUAL: diff --git a/src/libs/3rdparty/cplusplus/Token.cpp b/src/libs/3rdparty/cplusplus/Token.cpp index 1d9127b2dda..31fdb2036c2 100644 --- a/src/libs/3rdparty/cplusplus/Token.cpp +++ b/src/libs/3rdparty/cplusplus/Token.cpp @@ -91,6 +91,7 @@ const char *token_names[] = { ("<="), ("<<"), ("<<="), + ("<=>"), ("-"), ("-="), ("--"), diff --git a/src/libs/3rdparty/cplusplus/Token.h b/src/libs/3rdparty/cplusplus/Token.h index f5459786694..3a04a44a86a 100644 --- a/src/libs/3rdparty/cplusplus/Token.h +++ b/src/libs/3rdparty/cplusplus/Token.h @@ -99,6 +99,7 @@ enum Kind { T_LESS_EQUAL, T_LESS_LESS, T_LESS_LESS_EQUAL, + T_LESS_EQUAL_GREATER, T_MINUS, T_MINUS_EQUAL, T_MINUS_MINUS, @@ -446,6 +447,7 @@ struct LanguageFeatures unsigned int cxxEnabled : 1; unsigned int cxx11Enabled : 1; unsigned int cxx14Enabled : 1; + unsigned int cxx20Enabled : 1; unsigned int objCEnabled : 1; unsigned int c99Enabled : 1; }; diff --git a/src/libs/cplusplus/NamePrettyPrinter.cpp b/src/libs/cplusplus/NamePrettyPrinter.cpp index 8a2ff8d6f3c..9685cdf2a1b 100644 --- a/src/libs/cplusplus/NamePrettyPrinter.cpp +++ b/src/libs/cplusplus/NamePrettyPrinter.cpp @@ -222,6 +222,9 @@ void NamePrettyPrinter::visit(const OperatorNameId *name) case OperatorNameId::ArrayAccessOp: _name += QLatin1String("[]"); break; + case OperatorNameId::SpaceShipOp: + _name += QLatin1String("<=>"); + break; } // switch } diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 40b7d44e66e..50cd1241de8 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -202,6 +202,24 @@ struct Value inline bool is_zero () const { return l == 0; } + template static bool cmpImpl(T v1, T v2) + { + if (v1 < v2) + return -1; + if (v1 > v2) + return 1; + return 0; + } + Value cmp(const Value &other) const + { + Value v = *this; + if (v.is_ulong() || other.is_ulong()) + v.set_long(cmpImpl(v.ul, other.ul)); + else + v.set_long(cmpImpl(v.l, other.l)); + return v; + } + #define PP_DEFINE_BIN_OP(name, op) \ inline Value operator op(const Value &other) const \ { \ @@ -488,24 +506,25 @@ private: inline int precedence(int tokenKind) const { switch (tokenKind) { - case T_PIPE_PIPE: return 0; - case T_AMPER_AMPER: return 1; - case T_PIPE: return 2; - case T_CARET: return 3; - case T_AMPER: return 4; + case T_PIPE_PIPE: return 0; + case T_AMPER_AMPER: return 1; + case T_PIPE: return 2; + case T_CARET: return 3; + case T_AMPER: return 4; case T_EQUAL_EQUAL: - case T_EXCLAIM_EQUAL: return 5; + case T_EXCLAIM_EQUAL: return 5; case T_GREATER: case T_LESS: case T_LESS_EQUAL: - case T_GREATER_EQUAL: return 6; + case T_GREATER_EQUAL: return 6; + case T_LESS_EQUAL_GREATER: return 7; case T_LESS_LESS: - case T_GREATER_GREATER: return 7; + case T_GREATER_GREATER: return 8; case T_PLUS: - case T_MINUS: return 8; + case T_MINUS: return 9; case T_STAR: case T_SLASH: - case T_PERCENT: return 9; + case T_PERCENT: return 10; default: return -1; @@ -525,6 +544,7 @@ private: case T_GREATER: case T_LESS: case T_LESS_EQUAL: + case T_LESS_EQUAL_GREATER: case T_GREATER_EQUAL: case T_LESS_LESS: case T_GREATER_GREATER: @@ -543,24 +563,25 @@ private: static inline Value evaluate_expression(int tokenKind, const Value &lhs, const Value &rhs) { switch (tokenKind) { - case T_PIPE_PIPE: return lhs || rhs; - case T_AMPER_AMPER: return lhs && rhs; - case T_PIPE: return lhs | rhs; - case T_CARET: return lhs ^ rhs; - case T_AMPER: return lhs & rhs; - case T_EQUAL_EQUAL: return lhs == rhs; - case T_EXCLAIM_EQUAL: return lhs != rhs; - case T_GREATER: return lhs > rhs; - case T_LESS: return lhs < rhs; - case T_LESS_EQUAL: return lhs <= rhs; - case T_GREATER_EQUAL: return lhs >= rhs; - case T_LESS_LESS: return lhs << rhs; - case T_GREATER_GREATER: return lhs >> rhs; - case T_PLUS: return lhs + rhs; - case T_MINUS: return lhs - rhs; - case T_STAR: return lhs * rhs; - case T_SLASH: return rhs.is_zero() ? Value() : lhs / rhs; - case T_PERCENT: return rhs.is_zero() ? Value() : lhs % rhs; + case T_PIPE_PIPE: return lhs || rhs; + case T_AMPER_AMPER: return lhs && rhs; + case T_PIPE: return lhs | rhs; + case T_CARET: return lhs ^ rhs; + case T_AMPER: return lhs & rhs; + case T_EQUAL_EQUAL: return lhs == rhs; + case T_EXCLAIM_EQUAL: return lhs != rhs; + case T_GREATER: return lhs > rhs; + case T_LESS: return lhs < rhs; + case T_LESS_EQUAL: return lhs <= rhs; + case T_LESS_EQUAL_GREATER: return lhs.cmp(rhs); + case T_GREATER_EQUAL: return lhs >= rhs; + case T_LESS_LESS: return lhs << rhs; + case T_GREATER_GREATER: return lhs >> rhs; + case T_PLUS: return lhs + rhs; + case T_MINUS: return lhs - rhs; + case T_STAR: return lhs * rhs; + case T_SLASH: return rhs.is_zero() ? Value() : lhs / rhs; + case T_PERCENT: return rhs.is_zero() ? Value() : lhs % rhs; default: return Value(); diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 458a8f2f704..8c4f2e2bb68 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -99,3 +99,4 @@ add_subdirectory(studiowelcome) add_subdirectory(qnx) add_subdirectory(webassembly) add_subdirectory(mcusupport) +add_subdirectory(saferenderer) diff --git a/src/plugins/clangcodemodel/clangdfindreferences.cpp b/src/plugins/clangcodemodel/clangdfindreferences.cpp index f2102325f06..8a2d3faaeff 100644 --- a/src/plugins/clangcodemodel/clangdfindreferences.cpp +++ b/src/plugins/clangcodemodel/clangdfindreferences.cpp @@ -131,7 +131,8 @@ ClangdFindReferences::ClangdFindReferences(ClangdClient *client, TextDocument *d replacement ? SearchResultWindow::SearchAndReplace : SearchResultWindow::SearchOnly, SearchResultWindow::PreserveCaseDisabled, "CppEditor"); - d->search->makeNonInteractive(callback); + if (callback) + d->search->makeNonInteractive(callback); if (categorize) d->search->setFilter(new CppSearchResultFilter); if (d->replacementData) { diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h index 0f01cc69c5d..2d4cd089a0c 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h @@ -62,6 +62,8 @@ const char CMAKE_FEATURE_ID[] = "CMakeProjectManager.Wizard.FeatureCMake"; // Tool const char TOOL_ID[] = "CMakeProjectManager.CMakeKitInformation"; +// Data +const char BUILD_FOLDER_ROLE[] = "CMakeProjectManager.data.buildFolder"; } // namespace Constants } // namespace CMakeProjectManager diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp index cd300916253..36016aa0c94 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectnodes.cpp @@ -108,6 +108,9 @@ QVariant CMakeTargetNode::data(Id role) const return {}; }; + if (role == Constants::BUILD_FOLDER_ROLE) + return m_buildDirectory.toVariant(); + if (role == Android::Constants::AndroidAbi) return value(Android::Constants::ANDROID_ABI); diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp index bf61ee848dd..2606791942f 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdatabaseproject.cpp @@ -108,7 +108,7 @@ ToolChain *toolchainFromFlags(const Kit *kit, const QStringList &flags, const Ut return ToolChainKitAspect::toolChain(kit, language); // Try exact compiler match. - const Utils::FilePath compiler = Utils::FilePath::fromString(compilerPath(flags.front())); + const Utils::FilePath compiler = Utils::FilePath::fromUserInput(compilerPath(flags.front())); ToolChain *toolchain = ToolChainManager::toolChain([&compiler, &language](const ToolChain *tc) { return tc->isValid() && tc->language() == language && tc->compilerCommand() == compiler; }); diff --git a/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp b/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp index 01ec506c27a..bf5ff01e2ae 100644 --- a/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp +++ b/src/plugins/compilationdatabaseprojectmanager/compilationdbparser.cpp @@ -157,11 +157,8 @@ static QStringList jsonObjectFlags(const QJsonObject &object, QSet &fla static FilePath jsonObjectFilePath(const QJsonObject &object) { - const QString workingDir = QDir::cleanPath(object["directory"].toString()); - FilePath fileName = FilePath::fromString(QDir::cleanPath(object["file"].toString())); - if (fileName.toFileInfo().isRelative()) - fileName = FilePath::fromString(QDir::cleanPath(workingDir + "/" + fileName.toString())); - return fileName; + const FilePath workingDir = FilePath::fromUserInput(object["directory"].toString()); + return workingDir.resolvePath(object["file"].toString()); } std::vector CompilationDbParser::readJsonObjects() const diff --git a/src/plugins/cppeditor/cppcodemodelinspectordumper.cpp b/src/plugins/cppeditor/cppcodemodelinspectordumper.cpp index 8d77db098bd..45de8f30539 100644 --- a/src/plugins/cppeditor/cppcodemodelinspectordumper.cpp +++ b/src/plugins/cppeditor/cppcodemodelinspectordumper.cpp @@ -219,6 +219,7 @@ QString Utils::toString(CPlusPlus::Kind kind) TOKEN(T_LBRACKET); TOKEN(T_LESS); TOKEN(T_LESS_EQUAL); + TOKEN(T_LESS_EQUAL_GREATER); TOKEN(T_LESS_LESS); TOKEN(T_LESS_LESS_EQUAL); TOKEN(T_LPAREN); diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp index fe693bbbfc9..20fe8e6254b 100644 --- a/src/plugins/cppeditor/cppeditorwidget.cpp +++ b/src/plugins/cppeditor/cppeditorwidget.cpp @@ -26,10 +26,14 @@ #include #include #include +#include +#include +#include #include #include #include +#include #include #include @@ -614,9 +618,19 @@ void CppEditorWidget::renameUsages(const QString &replacement, QTextCursor curso { if (cursor.isNull()) cursor = textCursor(); - CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this, textDocument()}; - QPointer cppEditorWidget = this; - d->m_modelManager->globalRename(cursorInEditor, replacement); + + // First check if the symbol to be renamed comes from a generated file. + LinkHandler continuation = [=, self = QPointer(this)](const Link &link) { + if (!self) + return; + showRenameWarningIfFileIsGenerated(link.targetFilePath); + CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this, textDocument()}; + QPointer cppEditorWidget = this; + d->m_modelManager->globalRename(cursorInEditor, replacement); + }; + CppModelManager::followSymbol( + CursorInEditor{cursor, textDocument()->filePath(), this, textDocument()}, + continuation, true, false); } void CppEditorWidget::renameUsages(const Utils::FilePath &filePath, const QString &replacement, @@ -737,6 +751,45 @@ void CppEditorWidget::handleOutlineChanged(const QWidget *newOutline) } } +void CppEditorWidget::showRenameWarningIfFileIsGenerated(const Utils::FilePath &filePath) +{ + if (filePath.isEmpty()) + return; + for (const Project * const project : SessionManager::projects()) { + const Node * const node = project->nodeForFilePath(filePath); + if (!node) + continue; + if (!node->isGenerated()) + return; + ExtraCompiler *ec = nullptr; + QString warning = CppEditor::Tr::tr( + "You are trying to rename a symbol declared in the generated file \"%1\".\n" + "This is normally not a good idea, as the file will likely get " + "overwritten during the build process.") + .arg(filePath.toUserOutput()); + if (const Target * const target = project->activeTarget()) { + if (const BuildSystem * const bs = target->buildSystem()) + ec = bs->extraCompilerForTarget(filePath); + } + if (ec) { + warning.append('\n').append(CppEditor::Tr::tr( + "Do you want to edit \"%1\" instead?") + .arg(ec->source().toUserOutput())); + } + static const Id infoId("cppeditor.renameWarning"); + InfoBarEntry info(infoId, warning); + if (ec) { + info.addCustomButton(CppEditor::Tr::tr("Open %1").arg(ec->source().fileName()), + [source = ec->source()] { + EditorManager::openEditor(source); + ICore::infoBar()->removeInfo(infoId); + }); + } + ICore::infoBar()->addInfo(info); + return; + } +} + namespace { using Utils::Text::selectAt; diff --git a/src/plugins/cppeditor/cppeditorwidget.h b/src/plugins/cppeditor/cppeditorwidget.h index a42d786ead9..e9c0d11275c 100644 --- a/src/plugins/cppeditor/cppeditorwidget.h +++ b/src/plugins/cppeditor/cppeditorwidget.h @@ -136,6 +136,7 @@ private: const ProjectPart *projectPart() const; void handleOutlineChanged(const QWidget* newOutline); + void showRenameWarningIfFileIsGenerated(const Utils::FilePath &filePath); private: QScopedPointer d; diff --git a/src/plugins/cppeditor/projectpart.cpp b/src/plugins/cppeditor/projectpart.cpp index 7660499bc9c..9cab9a6df2b 100644 --- a/src/plugins/cppeditor/projectpart.cpp +++ b/src/plugins/cppeditor/projectpart.cpp @@ -163,6 +163,7 @@ CPlusPlus::LanguageFeatures ProjectPart::deriveLanguageFeatures() const CPlusPlus::LanguageFeatures features; features.cxx11Enabled = languageVersion >= Utils::LanguageVersion::CXX11; features.cxx14Enabled = languageVersion >= Utils::LanguageVersion::CXX14; + features.cxx20Enabled = languageVersion >= Utils::LanguageVersion::CXX20; features.cxxEnabled = hasCxx; features.c99Enabled = languageVersion >= Utils::LanguageVersion::C99; features.objCEnabled = languageExtensions.testFlag(Utils::LanguageExtension::ObjectiveC); diff --git a/src/plugins/mcusupport/CMakeLists.txt b/src/plugins/mcusupport/CMakeLists.txt index 57b12dd1b04..778f0a70394 100644 --- a/src/plugins/mcusupport/CMakeLists.txt +++ b/src/plugins/mcusupport/CMakeLists.txt @@ -22,6 +22,7 @@ add_qtc_plugin(McuSupport mcutargetdescription.h mcuhelpers.cpp mcuhelpers.h settingshandler.cpp settingshandler.h + mcuqmlprojectnode.cpp mcuqmlprojectnode.h ) add_subdirectory(test) diff --git a/src/plugins/mcusupport/mcuqmlprojectnode.cpp b/src/plugins/mcusupport/mcuqmlprojectnode.cpp new file mode 100644 index 00000000000..9b1c1caf89d --- /dev/null +++ b/src/plugins/mcusupport/mcuqmlprojectnode.cpp @@ -0,0 +1,96 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "mcuqmlprojectnode.h" + +#include + +namespace McuSupport::Internal { + +using namespace ProjectExplorer; +using namespace Utils; + +McuQmlProjectNode::McuQmlProjectNode(const FilePath &projectFolder, const FilePath &inputsJsonFile) + : FolderNode(projectFolder) +{ + setDisplayName("QmlProject"); + setIcon(DirectoryIcon(":/projectexplorer/images/fileoverlay_qml.png")); + setIsGenerated(false); + setPriority(Node::DefaultProjectPriority); + setFilePath(projectFolder); + setListInProject(true); + + const expected_str expectedJsonContent = inputsJsonFile.fileContents(); + if (!expectedJsonContent) + return; + + const QJsonDocument inputDoc = QJsonDocument::fromJson(*expectedJsonContent); + const QVariantMap mainProjectObject = inputDoc.object().toVariantMap(); + const FilePath mainProjectFilePath = FilePath::fromUserInput( + mainProjectObject.value("qmlProjectFile", "").toString()); + + auto mainFileNode = std::make_unique(mainProjectFilePath, + FileNode::fileTypeForFileName( + mainProjectFilePath)); + mainFileNode->setPriority(100); + addNestedNode(std::move(mainFileNode)); + + this->populateModuleNode(this, mainProjectObject); + + auto modulesNode = std::make_unique(filePath()); + modulesNode->setDisplayName("QmlProject Modules"); + modulesNode->setIcon(DirectoryIcon(":/projectexplorer/images/fileoverlay_modules.png")); + modulesNode->setPriority(10); + for (QVariant moduleVariant : mainProjectObject.value("modulesDependencies", {}).toList()) { + const QVariantMap moduleObject = moduleVariant.toMap(); + auto moduleNode = std::make_unique(filePath()); + moduleNode->setIcon(DirectoryIcon(":/projectexplorer/images/fileoverlay_qml.png")); + moduleNode->setDisplayName( + FilePath::fromUserInput(moduleObject.value("qmlProjectFile", "module").toString()) + .baseName()); + populateModuleNode(moduleNode.get(), moduleObject); + modulesNode->addNode(std::move(moduleNode)); + } + addNode(std::move(modulesNode)); +} + +bool McuQmlProjectNode::populateModuleNode(FolderNode *moduleNode, const QVariantMap &moduleObject) +{ + if (!moduleNode) + return false; + + const static int NODES_COUNT = 6; + const static QString nodes[NODES_COUNT] = {"QmlFiles", + "ImageFiles", + "InterfaceFiles", + "FontFiles", + "TranslationFiles", + "ModuleFiles"}; + const static QString icons[NODES_COUNT] = {":/projectexplorer/images/fileoverlay_qml.png", + ":/projectexplorer/images/fileoverlay_qrc.png", + ":/projectexplorer/images/fileoverlay_h.png", + ":/projectexplorer/images/fileoverlay_qrc.png", + ":/projectexplorer/images/fileoverlay_qrc.png", + ":/projectexplorer/images/fileoverlay_qml.png"}; + const static int priorities[NODES_COUNT] = {70, 60, 50, 40, 30, 20}; + + for (int i = 0; i < NODES_COUNT; i++) { + const QString &node = nodes[i]; + const QString &icon = icons[i]; + const int &p = priorities[i]; + auto foldernode = std::make_unique(filePath()); + foldernode->setShowWhenEmpty(false); + foldernode->setDisplayName(node); + foldernode->setIcon(DirectoryIcon(icon)); + foldernode->setPriority(p); + const auto nodeFiles = moduleObject.value(node, {}).toStringList(); + for (auto p : nodeFiles) { + const FilePath nodePath = FilePath::fromUserInput(p); + foldernode->addNestedNode( + std::make_unique(nodePath, FileNode::fileTypeForFileName(nodePath))); + } + moduleNode->addNode(std::move(foldernode)); + } + return true; +} +} // namespace McuSupport::Internal diff --git a/src/plugins/mcusupport/mcuqmlprojectnode.h b/src/plugins/mcusupport/mcuqmlprojectnode.h new file mode 100644 index 00000000000..2a06e5cde55 --- /dev/null +++ b/src/plugins/mcusupport/mcuqmlprojectnode.h @@ -0,0 +1,47 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#pragma once + +#include "mcuqmlprojectnode.h" +#include "mcusupport_global.h" +#include "mcusupportplugin.h" + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +namespace McuSupport::Internal { + +using namespace ProjectExplorer; +using namespace Utils; + +class McuQmlProjectFolderNode : public FolderNode +{ +public: + explicit McuQmlProjectFolderNode(const FilePath &path) + : FolderNode(path) + {} + bool showInSimpleTree() const override { return true; } +}; + +class McuQmlProjectNode : public FolderNode +{ +public: + explicit McuQmlProjectNode(const FilePath &projectFolder, const FilePath &inputsJsonFile); + bool showInSimpleTree() const override { return true; } + bool populateModuleNode(FolderNode *moduleNode, const QVariantMap &moduleObject); +}; +}; // namespace McuSupport::Internal diff --git a/src/plugins/mcusupport/mcusupport.qbs b/src/plugins/mcusupport/mcusupport.qbs index efd14b453b0..e6aec151a06 100644 --- a/src/plugins/mcusupport/mcusupport.qbs +++ b/src/plugins/mcusupport/mcusupport.qbs @@ -37,6 +37,8 @@ QtcPlugin { "mcusupportoptions.h", "mcukitmanager.cpp", "mcukitmanager.h", + "mcuqmlprojectnode.cpp", + "mcuqmlprojectnode.h", "mcusupportoptionspage.cpp", "mcusupportoptionspage.h", "mcusupportplugin.cpp", diff --git a/src/plugins/mcusupport/mcusupportplugin.cpp b/src/plugins/mcusupport/mcusupportplugin.cpp index 835e619a3ce..8e873785916 100644 --- a/src/plugins/mcusupport/mcusupportplugin.cpp +++ b/src/plugins/mcusupport/mcusupportplugin.cpp @@ -5,6 +5,7 @@ #include "mcukitinformation.h" #include "mcukitmanager.h" +#include "mcuqmlprojectnode.h" #include "mcusupportconstants.h" #include "mcusupportdevice.h" #include "mcusupportoptions.h" @@ -24,8 +25,15 @@ #include #include #include +#include #include +#include +#include +#include +#include + +#include #include #include @@ -49,6 +57,42 @@ void printMessage(const QString &message, bool important) Core::MessageManager::writeSilently(displayMessage); } +void updateMCUProjectTree(ProjectExplorer::Project *p) +{ + if (!p || !p->rootProjectNode()) + return; + ProjectExplorer::Target *target = p->activeTarget(); + if (!target || !target->kit() + || !target->kit()->hasValue(Constants::KIT_MCUTARGET_KITVERSION_KEY)) + return; + + p->rootProjectNode()->forEachProjectNode([](const ProjectNode *node) { + if (!node) + return; + + const FilePath projectBuildFolder = FilePath::fromVariant( + node->data(CMakeProjectManager::Constants::BUILD_FOLDER_ROLE)); + const QString targetName = node->displayName(); + if (targetName.isEmpty()) + return; + + const FilePath inputsJsonFile = projectBuildFolder / "CMakeFiles" / (targetName + ".dir") + / "config/input.json"; + + printMessage("found Input json file " + inputsJsonFile.absoluteFilePath().toString(), true); + + if (!inputsJsonFile.exists()) + return; + + auto qmlProjectNode = std::make_unique(FilePath(node->filePath()), + inputsJsonFile); + + auto qmlProjectNodePtr = qmlProjectNode.get(); + const_cast(node)->addNode(std::move(qmlProjectNode)); + ProjectExplorer::ProjectTree::emitSubtreeChanged(qmlProjectNodePtr); + }); +}; + class McuSupportPluginPrivate { public: @@ -74,6 +118,10 @@ void McuSupportPlugin::initialize() setObjectName("McuSupportPlugin"); dd = new McuSupportPluginPrivate; + connect(SessionManager::instance(), + &SessionManager::projectFinishedParsing, + updateMCUProjectTree); + dd->m_options.registerQchFiles(); dd->m_options.registerExamples(); ProjectExplorer::JsonWizardFactory::addWizardPath(":/mcusupport/wizards/"); diff --git a/src/plugins/nim/nimplugin.cpp b/src/plugins/nim/nimplugin.cpp index 9d46835ef03..fcca3ef8d38 100644 --- a/src/plugins/nim/nimplugin.cpp +++ b/src/plugins/nim/nimplugin.cpp @@ -23,7 +23,6 @@ #include "suggest/nimsuggestcache.h" #include -#include #include #include #include @@ -66,6 +65,9 @@ public: NimToolsSettingsPage toolsSettingsPage{&settings}; NimCodeStylePreferencesFactory codeStylePreferencesPage; NimToolChainFactory toolChainFactory; + + NimProjectFactory nimProjectFactory; + NimbleProjectFactory nimbleProjectFactory; }; NimPlugin::~NimPlugin() @@ -82,9 +84,6 @@ void NimPlugin::initialize() TextEditor::SnippetProvider::registerGroup(Constants::C_NIMSNIPPETSGROUP_ID, Tr::tr("Nim", "SnippetProvider"), &NimEditorFactory::decorateEditor); - - ProjectManager::registerProjectType(Constants::C_NIM_PROJECT_MIMETYPE); - ProjectManager::registerProjectType(Constants::C_NIMBLE_MIMETYPE); } void NimPlugin::extensionsInitialized() diff --git a/src/plugins/nim/project/nimbleproject.cpp b/src/plugins/nim/project/nimbleproject.cpp index 428db0b1135..5777724afbd 100644 --- a/src/plugins/nim/project/nimbleproject.cpp +++ b/src/plugins/nim/project/nimbleproject.cpp @@ -6,7 +6,10 @@ #include "nimblebuildsystem.h" #include + #include +#include + #include using namespace ProjectExplorer; @@ -47,4 +50,11 @@ void NimbleProject::setExcludedFiles(const QStringList &excludedFiles) m_excludedFiles = excludedFiles; } +// Factory + +NimbleProjectFactory::NimbleProjectFactory() +{ + ProjectManager::registerProjectType(Constants::C_NIMBLE_MIMETYPE); +} + } // Nim diff --git a/src/plugins/nim/project/nimbleproject.h b/src/plugins/nim/project/nimbleproject.h index c7b759c50a7..9abbc90dcc4 100644 --- a/src/plugins/nim/project/nimbleproject.h +++ b/src/plugins/nim/project/nimbleproject.h @@ -28,4 +28,10 @@ protected: QStringList m_excludedFiles; }; +class NimbleProjectFactory +{ +public: + NimbleProjectFactory(); +}; + } // Nim diff --git a/src/plugins/nim/project/nimproject.cpp b/src/plugins/nim/project/nimproject.cpp index a5d36425426..4a2bc060260 100644 --- a/src/plugins/nim/project/nimproject.cpp +++ b/src/plugins/nim/project/nimproject.cpp @@ -9,18 +9,40 @@ #include "nimtoolchain.h" #include + #include #include +#include using namespace ProjectExplorer; using namespace Utils; namespace Nim { -NimProject::NimProject(const FilePath &fileName) : Project(Constants::C_NIM_MIMETYPE, fileName) +class NimProject : public Project +{ +public: + explicit NimProject(const FilePath &filePath); + + Tasks projectIssues(const Kit *k) const final; + + // Keep for compatibility with Qt Creator 4.10 + QVariantMap toMap() const final; + + QStringList excludedFiles() const; + void setExcludedFiles(const QStringList &excludedFiles); + +protected: + // Keep for compatibility with Qt Creator 4.10 + RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) final; + + QStringList m_excludedFiles; +}; + +NimProject::NimProject(const FilePath &filePath) : Project(Constants::C_NIM_MIMETYPE, filePath) { setId(Constants::C_NIMPROJECT_ID); - setDisplayName(fileName.completeBaseName()); + setDisplayName(filePath.completeBaseName()); // ensure debugging is enabled (Nim plugin translates nim code to C code) setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); @@ -65,4 +87,11 @@ void NimProject::setExcludedFiles(const QStringList &excludedFiles) m_excludedFiles = excludedFiles; } +// Factory + +NimProjectFactory::NimProjectFactory() +{ + ProjectManager::registerProjectType(Constants::C_NIM_PROJECT_MIMETYPE); +} + } // Nim diff --git a/src/plugins/nim/project/nimproject.h b/src/plugins/nim/project/nimproject.h index 7b8e74a53b6..5bdc12f1d58 100644 --- a/src/plugins/nim/project/nimproject.h +++ b/src/plugins/nim/project/nimproject.h @@ -3,36 +3,12 @@ #pragma once -#include -#include - -#include -#include - namespace Nim { -class NimBuildSystem; - -class NimProject : public ProjectExplorer::Project +class NimProjectFactory { - Q_OBJECT - public: - explicit NimProject(const Utils::FilePath &fileName); - - ProjectExplorer::Tasks projectIssues(const ProjectExplorer::Kit *k) const final; - - // Keep for compatibility with Qt Creator 4.10 - QVariantMap toMap() const final; - - QStringList excludedFiles() const; - void setExcludedFiles(const QStringList &excludedFiles); - -protected: - // Keep for compatibility with Qt Creator 4.10 - RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) final; - - QStringList m_excludedFiles; + NimProjectFactory(); }; -} // namespace Nim +} // Nim diff --git a/src/plugins/plugins.qbs b/src/plugins/plugins.qbs index ecf52fb3609..b878e76c3e3 100644 --- a/src/plugins/plugins.qbs +++ b/src/plugins/plugins.qbs @@ -71,6 +71,7 @@ Project { "qtsupport/qtsupport.qbs", "remotelinux/remotelinux.qbs", "resourceeditor/resourceeditor.qbs", + "saferenderer/saferenderer.qbs", "scxmleditor/scxmleditor.qbs", "serialterminal/serialterminal.qbs", "silversearcher/silversearcher.qbs", diff --git a/src/plugins/projectexplorer/buildsystem.cpp b/src/plugins/projectexplorer/buildsystem.cpp index b103d974683..0a2c2f3a85d 100644 --- a/src/plugins/projectexplorer/buildsystem.cpp +++ b/src/plugins/projectexplorer/buildsystem.cpp @@ -248,6 +248,13 @@ ExtraCompiler *BuildSystem::extraCompilerForSource(const Utils::FilePath &source return findExtraCompiler([source](const ExtraCompiler *ec) { return ec->source() == source; }); } +ExtraCompiler *BuildSystem::extraCompilerForTarget(const Utils::FilePath &target) const +{ + return findExtraCompiler([target](const ExtraCompiler *ec) { + return ec->targets().contains(target); + }); +} + MakeInstallCommand BuildSystem::makeInstallCommand(const FilePath &installRoot) const { QTC_ASSERT(target()->project()->hasMakeInstallEquivalent(), return {}); diff --git a/src/plugins/projectexplorer/buildsystem.h b/src/plugins/projectexplorer/buildsystem.h index 1fcbdbff18f..0d19c9110ec 100644 --- a/src/plugins/projectexplorer/buildsystem.h +++ b/src/plugins/projectexplorer/buildsystem.h @@ -85,6 +85,7 @@ public: // Owned by the build system. Use only in main thread. Can go away at any time. ExtraCompiler *extraCompilerForSource(const Utils::FilePath &source) const; + ExtraCompiler *extraCompilerForTarget(const Utils::FilePath &target) const; virtual MakeInstallCommand makeInstallCommand(const Utils::FilePath &installRoot) const; diff --git a/src/plugins/projectexplorer/sessiondialog.cpp b/src/plugins/projectexplorer/sessiondialog.cpp index cef6f34b06e..745a876230a 100644 --- a/src/plugins/projectexplorer/sessiondialog.cpp +++ b/src/plugins/projectexplorer/sessiondialog.cpp @@ -71,6 +71,7 @@ SessionNameInputDialog::SessionNameInputDialog(QWidget *parent) auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); m_okButton = buttons->button(QDialogButtonBox::Ok); m_switchToButton = new QPushButton; + m_switchToButton->setDefault(true); buttons->addButton(m_switchToButton, QDialogButtonBox::AcceptRole); connect(m_switchToButton, &QPushButton::clicked, this, [this] { m_usedSwitchTo = true; @@ -83,6 +84,13 @@ SessionNameInputDialog::SessionNameInputDialog(QWidget *parent) buttons, }.attachTo(this); + connect(m_newSessionLineEdit, &QLineEdit::textChanged, [this](const QString &text) { + m_okButton->setEnabled(!text.isEmpty()); + m_switchToButton->setEnabled(!text.isEmpty()); + }); + m_okButton->setEnabled(false); + m_switchToButton->setEnabled(false); + connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); } diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index dab9af41364..57088ad19bf 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -173,18 +173,17 @@ public: runControl->target()->buildSystem()); QTC_ASSERT(qmlBuildSystem, return); - const QString mainScript = aspect->mainScript; - const QString currentFile = aspect->currentFile; + const FilePath mainScript = aspect->mainScript; + const FilePath currentFile = aspect->currentFile; - const QString mainScriptFromProject = qmlBuildSystem->targetFile( - FilePath::fromString(mainScript)).path(); + const QString mainScriptFromProject = qmlBuildSystem->targetFile(mainScript).path(); QStringList qmlProjectRunConfigurationArguments = cmd.splitArguments(); if (!currentFile.isEmpty() && qmlProjectRunConfigurationArguments.last().contains(mainScriptFromProject)) { qmlProjectRunConfigurationArguments.removeLast(); cmd = CommandLine(cmd.executable(), qmlProjectRunConfigurationArguments); - cmd.addArg(currentFile); + cmd.addArg(currentFile.path()); } } diff --git a/src/plugins/qmlprojectmanager/qmlmainfileaspect.cpp b/src/plugins/qmlprojectmanager/qmlmainfileaspect.cpp index 820f85085cf..08e236504d7 100644 --- a/src/plugins/qmlprojectmanager/qmlmainfileaspect.cpp +++ b/src/plugins/qmlprojectmanager/qmlmainfileaspect.cpp @@ -32,9 +32,9 @@ namespace QmlProjectManager { const char M_CURRENT_FILE[] = "CurrentFile"; const char CURRENT_FILE[] = QT_TRANSLATE_NOOP("::QmlProjectManager", ""); -static bool caseInsensitiveLessThan(const QString &s1, const QString &s2) +static bool caseInsensitiveLessThan(const FilePath &s1, const FilePath &s2) { - return s1.toLower() < s2.toLower(); + return s1.toString().toCaseFolded() < s2.toString().toCaseFolded(); } QmlMainFileAspect::QmlMainFileAspect(Target *target) @@ -89,12 +89,12 @@ void QmlMainFileAspect::fromMap(const QVariantMap &map) void QmlMainFileAspect::updateFileComboBox() { - QDir projectDir(m_target->project()->projectDirectory().toString()); + const FilePath projectDir = m_target->project()->projectDirectory(); if (mainScriptSource() == FileInProjectFile) { - const QString mainScriptInFilePath = projectDir.relativeFilePath(mainScript()); + const FilePath mainScriptInFilePath = projectDir.relativeChildPath(mainScript()); m_fileListModel.clear(); - m_fileListModel.appendRow(new QStandardItem(mainScriptInFilePath)); + m_fileListModel.appendRow(new QStandardItem(mainScriptInFilePath.toString())); if (m_fileListCombo) m_fileListCombo->setEnabled(false); return; @@ -106,27 +106,25 @@ void QmlMainFileAspect::updateFileComboBox() m_fileListModel.appendRow(new QStandardItem(CURRENT_FILE)); QModelIndex currentIndex; - QStringList sortedFiles = Utils::transform(m_target->project()->files(Project::SourceFiles), - &Utils::FilePath::toString); + FilePaths sortedFiles = m_target->project()->files(Project::SourceFiles); // make paths relative to project directory - QStringList relativeFiles; - for (const QString &fn : std::as_const(sortedFiles)) - relativeFiles += projectDir.relativeFilePath(fn); + FilePaths relativeFiles; + for (const FilePath &fn : std::as_const(sortedFiles)) + relativeFiles += projectDir.relativeChildPath(fn); sortedFiles = relativeFiles; std::stable_sort(sortedFiles.begin(), sortedFiles.end(), caseInsensitiveLessThan); - QString mainScriptPath; + FilePath mainScriptPath; if (mainScriptSource() != FileInEditor) - mainScriptPath = projectDir.relativeFilePath(mainScript()); + mainScriptPath = projectDir.relativeChildPath(mainScript()); - for (const QString &fn : std::as_const(sortedFiles)) { - QFileInfo fileInfo(fn); - if (fileInfo.suffix() != "qml") + for (const FilePath &fn : std::as_const(sortedFiles)) { + if (fn.suffixView() != u"qml") continue; - auto item = new QStandardItem(fn); + auto item = new QStandardItem(fn.toString()); m_fileListModel.appendRow(item); if (mainScriptPath == fn) @@ -170,7 +168,7 @@ void QmlMainFileAspect::setScriptSource(MainScriptSource source, const QString & m_mainScriptFilename.clear(); } else { // FileInSettings m_scriptFile = settingsPath; - m_mainScriptFilename = m_target->project()->projectDirectory().toString() + '/' + m_scriptFile; + m_mainScriptFilename = m_target->project()->projectDirectory() / m_scriptFile; } emit changed(); @@ -180,14 +178,11 @@ void QmlMainFileAspect::setScriptSource(MainScriptSource source, const QString & /** Returns absolute path to main script file. */ -QString QmlMainFileAspect::mainScript() const +FilePath QmlMainFileAspect::mainScript() const { if (!qmlBuildSystem()->mainFile().isEmpty()) { - const QString pathInProject = qmlBuildSystem()->mainFile(); - if (QFileInfo(pathInProject).isAbsolute()) - return pathInProject; - else - return QDir(qmlBuildSystem()->canonicalProjectDir().toString()).absoluteFilePath(pathInProject); + const FilePath pathInProject = qmlBuildSystem()->mainFile(); + return qmlBuildSystem()->canonicalProjectDir().resolvePath(pathInProject); } if (!m_mainScriptFilename.isEmpty()) @@ -196,7 +191,7 @@ QString QmlMainFileAspect::mainScript() const return m_currentFileFilename; } -QString QmlMainFileAspect::currentFile() const +FilePath QmlMainFileAspect::currentFile() const { return m_currentFileFilename; } @@ -207,7 +202,7 @@ void QmlMainFileAspect::changeCurrentFile(Core::IEditor *editor) editor = EditorManager::currentEditor(); if (editor) - m_currentFileFilename = editor->document()->filePath().toString(); + m_currentFileFilename = editor->document()->filePath(); emit changed(); } @@ -219,7 +214,7 @@ bool QmlMainFileAspect::isQmlFilePresent() IDocument *document = EditorManager::currentDocument(); const MimeType mainScriptMimeType = mimeTypeForFile(mainScript()); if (document) { - m_currentFileFilename = document->filePath().toString(); + m_currentFileFilename = document->filePath(); if (mainScriptMimeType.matchesName(ProjectExplorer::Constants::QML_MIMETYPE) || mainScriptMimeType.matchesName(ProjectExplorer::Constants::QMLUI_MIMETYPE)) { qmlFileFound = true; @@ -229,13 +224,13 @@ bool QmlMainFileAspect::isQmlFilePresent() || mainScriptMimeType.matchesName(QmlJSTools::Constants::QMLPROJECT_MIMETYPE)) { // find a qml file with lowercase filename. This is slow, but only done // in initialization/other border cases. - const auto files = m_target->project()->files(Project::SourceFiles); + const FilePaths files = m_target->project()->files(Project::SourceFiles); for (const FilePath &filename : files) { if (!filename.isEmpty() && filename.baseName().at(0).isLower()) { const MimeType type = mimeTypeForFile(filename); if (type.matchesName(ProjectExplorer::Constants::QML_MIMETYPE) || type.matchesName(ProjectExplorer::Constants::QMLUI_MIMETYPE)) { - m_currentFileFilename = filename.toString(); + m_currentFileFilename = filename; qmlFileFound = true; break; } @@ -252,4 +247,5 @@ QmlBuildSystem *QmlMainFileAspect::qmlBuildSystem() const { return static_cast(m_target->buildSystem()); } -} // namespace QmlProjectManager + +} // QmlProjectManager diff --git a/src/plugins/qmlprojectmanager/qmlmainfileaspect.h b/src/plugins/qmlprojectmanager/qmlmainfileaspect.h index 4ec23dc2cd5..b71fa6784b8 100644 --- a/src/plugins/qmlprojectmanager/qmlmainfileaspect.h +++ b/src/plugins/qmlprojectmanager/qmlmainfileaspect.h @@ -38,8 +38,8 @@ public: struct Data : BaseAspect::Data { - QString mainScript; - QString currentFile; + Utils::FilePath mainScript; + Utils::FilePath currentFile; }; void addToLayout(Utils::Layouting::LayoutBuilder &builder) final; @@ -52,8 +52,8 @@ public: void setScriptSource(MainScriptSource source, const QString &settingsPath = QString()); - QString mainScript() const; - QString currentFile() const; + Utils::FilePath mainScript() const; + Utils::FilePath currentFile() const; void changeCurrentFile(Core::IEditor *editor = nullptr); bool isQmlFilePresent(); QmlBuildSystem *qmlBuildSystem() const; @@ -64,9 +64,9 @@ public: QStandardItemModel m_fileListModel; QString m_scriptFile; // absolute path to current file (if being used) - QString m_currentFileFilename; + Utils::FilePath m_currentFileFilename; // absolute path to selected main script (if being used) - QString m_mainScriptFilename; + Utils::FilePath m_mainScriptFilename; }; -} // namespace QmlProjectManager +} // QmlProjectManager diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 6ce64397796..c283ec73e31 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -250,7 +250,9 @@ void QmlBuildSystem::parseProject(RefreshOptions options) } } -bool QmlBuildSystem::setFileSettingInProjectFile(const QString &setting, const Utils::FilePath &mainFilePath, const QString &oldFile) +bool QmlBuildSystem::setFileSettingInProjectFile(const QString &setting, + const FilePath &mainFilePath, + const FilePath &oldFile) { // make sure to change it also in the qmlproject file const Utils::FilePath qmlProjectFilePath = project()->projectFilePath(); @@ -283,7 +285,7 @@ bool QmlBuildSystem::setFileSettingInProjectFile(const QString &setting, const U auto index = fileContent.lastIndexOf("}"); fileContent.insert(index, addedText); } else { - QString originalFileName = oldFile; + QString originalFileName = oldFile.path(); originalFileName.replace(".", "\\."); const QRegularExpression expression(QString("%1\\s*\"(%2)\"").arg(settingQmlCode).arg(originalFileName)); @@ -328,43 +330,42 @@ void QmlBuildSystem::refresh(RefreshOptions options) emit projectChanged(); } -QString QmlBuildSystem::mainFile() const +FilePath QmlBuildSystem::mainFile() const { if (m_projectItem) - return m_projectItem->mainFile(); - return QString(); + return FilePath::fromString(m_projectItem->mainFile()); + return {}; } -QString QmlBuildSystem::mainUiFile() const +FilePath QmlBuildSystem::mainUiFile() const { if (m_projectItem) - return m_projectItem->mainUiFile(); - return QString(); + return FilePath::fromString(m_projectItem->mainUiFile()); + return {}; } -Utils::FilePath QmlBuildSystem::mainFilePath() const +FilePath QmlBuildSystem::mainFilePath() const { - return projectDirectory().pathAppended(mainFile()); + return projectDirectory().resolvePath(mainFile()); } -Utils::FilePath QmlBuildSystem::mainUiFilePath() const +FilePath QmlBuildSystem::mainUiFilePath() const { - return projectDirectory().pathAppended(mainUiFile()); + return projectDirectory().resolvePath(mainUiFile()); } -bool QmlBuildSystem::setMainFileInProjectFile(const Utils::FilePath &newMainFilePath) +bool QmlBuildSystem::setMainFileInProjectFile(const FilePath &newMainFilePath) { - return setFileSettingInProjectFile("mainFile", newMainFilePath, mainFile()); } -bool QmlBuildSystem::setMainUiFileInProjectFile(const Utils::FilePath &newMainUiFilePath) +bool QmlBuildSystem::setMainUiFileInProjectFile(const FilePath &newMainUiFilePath) { return setMainUiFileInMainFile(newMainUiFilePath) && setFileSettingInProjectFile("mainUiFile", newMainUiFilePath, mainUiFile()); } -bool QmlBuildSystem::setMainUiFileInMainFile(const Utils::FilePath &newMainUiFilePath) +bool QmlBuildSystem::setMainUiFileInMainFile(const FilePath &newMainUiFilePath) { Core::FileChangeBlocker fileChangeBlocker(mainFilePath()); const QList editors = Core::DocumentModel::editorsForFilePath(mainFilePath()); @@ -793,9 +794,9 @@ bool QmlBuildSystem::deleteFiles(Node *context, const FilePaths &filePaths) bool QmlBuildSystem::renameFile(Node * context, const FilePath &oldFilePath, const FilePath &newFilePath) { if (dynamic_cast(context)) { - if (oldFilePath.endsWith(mainFile())) + if (oldFilePath.endsWith(mainFile().path())) return setMainFileInProjectFile(newFilePath); - if (oldFilePath.endsWith(mainUiFile())) + if (oldFilePath.endsWith(mainUiFile().path())) return setMainUiFileInProjectFile(newFilePath); return true; diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h index ed52764f0a0..e7387e030ae 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.h +++ b/src/plugins/qmlprojectmanager/qmlproject.h @@ -53,8 +53,8 @@ public: void refresh(RefreshOptions options); Utils::FilePath canonicalProjectDir() const; - QString mainFile() const; - QString mainUiFile() const; + Utils::FilePath mainFile() const; + Utils::FilePath mainUiFile() const; Utils::FilePath mainFilePath() const; Utils::FilePath mainUiFilePath() const; @@ -106,7 +106,7 @@ signals: private: bool setFileSettingInProjectFile(const QString &setting, const Utils::FilePath &mainFilePath, - const QString &oldFile); + const Utils::FilePath &oldFile); std::unique_ptr m_projectItem; Utils::FilePath m_canonicalProjectDir; diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 081a0bec574..8e8527b32c0 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -54,7 +54,7 @@ private: QString disabledReason() const final; bool isEnabled() const final; - QString mainScript() const; + FilePath mainScript() const; FilePath qmlRuntimeFilePath() const; void createQtVersionAspect(); @@ -108,7 +108,7 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id) cmd.addArg("widget"); } - const FilePath main = bs->targetFile(FilePath::fromString(mainScript())); + const FilePath main = bs->targetFile(mainScript()); if (!main.isEmpty()) cmd.addArg(main.nativePath()); @@ -292,7 +292,7 @@ bool QmlProjectRunConfiguration::isEnabled() const && activeBuildSystem()->hasParsingData(); } -QString QmlProjectRunConfiguration::mainScript() const +FilePath QmlProjectRunConfiguration::mainScript() const { return m_qmlMainFileAspect->mainScript(); } diff --git a/src/plugins/saferenderer/CMakeLists.txt b/src/plugins/saferenderer/CMakeLists.txt new file mode 100644 index 00000000000..739332de42d --- /dev/null +++ b/src/plugins/saferenderer/CMakeLists.txt @@ -0,0 +1,8 @@ +add_qtc_plugin(SafeRenderer + DEPENDS + QtCreator::Core QtCreator::ProjectExplorer + SOURCES + saferenderer.qrc + saferenderer.cpp + saferenderer.h +) diff --git a/src/plugins/saferenderer/SafeRenderer.json.in b/src/plugins/saferenderer/SafeRenderer.json.in new file mode 100644 index 00000000000..c8a6e3ee795 --- /dev/null +++ b/src/plugins/saferenderer/SafeRenderer.json.in @@ -0,0 +1,20 @@ +{ + \"Name\" : \"SafeRenderer\", + \"Version\" : \"$$QTCREATOR_VERSION\", + \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", + \"DisabledByDefault\" : true, + \"Vendor\" : \"The Qt Company Ltd\", + \"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR The Qt Company Ltd\", + \"License\" : [ \"Commercial Usage\", + \"\", + \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\", + \"\", + \"GNU General Public License Usage\", + \"\", + \"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\" + ], + \"Category\" : \"Device Support\", + \"Description\" : \"Helper plugin for Qt Safe Renderer projects.\", + \"Url\" : \"https://www.qt.io\", + $$dependencyList +} diff --git a/src/plugins/saferenderer/saferenderer.cpp b/src/plugins/saferenderer/saferenderer.cpp new file mode 100644 index 00000000000..115b7c8728b --- /dev/null +++ b/src/plugins/saferenderer/saferenderer.cpp @@ -0,0 +1,29 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "saferenderer.h" + +#include + +namespace SafeRenderer::Internal { + +SafeRendererPlugin::SafeRendererPlugin() +{ +} + +SafeRendererPlugin::~SafeRendererPlugin() +{ +} + +bool SafeRendererPlugin::initialize(const QStringList &arguments, QString *errorString) +{ + Q_UNUSED(arguments) + Q_UNUSED(errorString) + + // Add Qt Creator project wizard path + ProjectExplorer::JsonWizardFactory::addWizardPath(":/saferenderer/wizards/"); + + return true; +} + +} // namespace SafeRenderer::Internal diff --git a/src/plugins/saferenderer/saferenderer.h b/src/plugins/saferenderer/saferenderer.h new file mode 100644 index 00000000000..1fabbff9ee1 --- /dev/null +++ b/src/plugins/saferenderer/saferenderer.h @@ -0,0 +1,22 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#pragma once + +#include + +namespace SafeRenderer::Internal { + +class SafeRendererPlugin : public ExtensionSystem::IPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "SafeRenderer.json") + +public: + SafeRendererPlugin(); + ~SafeRendererPlugin() override; + + bool initialize(const QStringList &arguments, QString *errorString) override; +}; + +} // namespace SafeRenderer::Internal diff --git a/src/plugins/saferenderer/saferenderer.qbs b/src/plugins/saferenderer/saferenderer.qbs new file mode 100644 index 00000000000..7945054eaec --- /dev/null +++ b/src/plugins/saferenderer/saferenderer.qbs @@ -0,0 +1,14 @@ +import qbs + +QtcPlugin { + name: "SafeRenderer" + + Depends { name: "Core" } + Depends { name: "ProjectExplorer" } + + files: [ + "saferenderer.cpp", + "saferenderer.h", + "saferenderer.qrc", + ] +} diff --git a/src/plugins/saferenderer/saferenderer.qrc b/src/plugins/saferenderer/saferenderer.qrc new file mode 100644 index 00000000000..28baa346473 --- /dev/null +++ b/src/plugins/saferenderer/saferenderer.qrc @@ -0,0 +1,12 @@ + + + wizards/icon.png + wizards/icon@2x.png + wizards/qsrapp/file.pro + wizards/qsrapp/main.cpp.tpl + wizards/qsrapp/main.qml.tpl + wizards/qsrapp/qml.qrc.tpl + wizards/qsrapp/safeasset.qrc.tpl + wizards/qsrapp/wizard.json + + diff --git a/src/plugins/saferenderer/wizards/icon.png b/src/plugins/saferenderer/wizards/icon.png new file mode 100644 index 00000000000..88826ce9fb0 Binary files /dev/null and b/src/plugins/saferenderer/wizards/icon.png differ diff --git a/src/plugins/saferenderer/wizards/icon@2x.png b/src/plugins/saferenderer/wizards/icon@2x.png new file mode 100644 index 00000000000..1838ac95117 Binary files /dev/null and b/src/plugins/saferenderer/wizards/icon@2x.png differ diff --git a/src/plugins/saferenderer/wizards/qsrapp/file.pro b/src/plugins/saferenderer/wizards/qsrapp/file.pro new file mode 100644 index 00000000000..0302daad207 --- /dev/null +++ b/src/plugins/saferenderer/wizards/qsrapp/file.pro @@ -0,0 +1,52 @@ +QT = qtsaferenderer qsrplatformadaptation + +CONFIG += c++17 + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \\ + %{CppFileName} + + +# List of language codes that your application supports. For example, SAFE_LANGUAGES = en fi. +#SAFE_LANGUAGES = en + +# List of translation file names excluding the language code. For example, SAFE_TRANSLATION = $$PWD/safeui. +#SAFE_TRANSLATION = $$PWD/safeui + +# List of translation file names including the language code. There must be one file +# for each language listed in SAFE_LANGUAGES. For example, TRANSLATIONS += safeui_en.ts safeui_fi.ts. +#TRANSLATIONS += safeui_en.ts + +# You can use an lupdate_only{...} conditional statement to specify the QML files that contain texts. +#lupdate_only { +# SOURCES += main.qml +#} + + +RESOURCES += qml.qrc + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = $$PWD/imports + +# Additional import path used to resolve QML modules just for Qt Quick Designer +QML_DESIGNER_IMPORT_PATH = + + +CONFIG += qtsaferenderer exceptions +SAFE_QML = $$PWD/main.qml +SAFE_LAYOUT_PATH = $$PWD/layoutData +SAFE_RESOURCES += safeasset.qrc + +!cross_compile: DEFINES += HOST_BUILD +!cross_compile: QT += widgets quick svg + +DISTFILES += main.qml diff --git a/src/plugins/saferenderer/wizards/qsrapp/main.cpp.tpl b/src/plugins/saferenderer/wizards/qsrapp/main.cpp.tpl new file mode 100644 index 00000000000..4f36c6f6fa3 --- /dev/null +++ b/src/plugins/saferenderer/wizards/qsrapp/main.cpp.tpl @@ -0,0 +1,66 @@ +%{Cpp:LicenseTemplate}\ +%{JS: QtSupport.qtIncludes([ 'QtCore/QCoreApplication' ], + [ 'QtCore/QCoreApplication' ]) }\ + +#include +#include +#include + +#if defined(HOST_BUILD) +#include +#include +#include +#endif + +#if defined(USE_OUTPUTVERIFIER) +#include +#include "testverifier.h" +#endif + +#include "safewindow.h" +#include "eventhandler.h" + +int main(int argc, char *argv[]) +{ + Q_UNUSED(argc); + Q_UNUSED(argv); + + static SafeRenderer::QSafeLayoutResourceReader layout("/layoutData/main/main.srl"); + +#if defined(USE_OUTPUTVERIFIER) + static OutputVerifier outputVerifier; +#if defined(HOST_BUILD) + //In host environment the TestVerifier must be explicitly created. + //In OpeWFD adaptation the MISRVerifier instance is created in the SafeWindow adaptation. + static TestVerifier testVerifier(outputVerifier); +#endif + SafeWindow telltaleWindow(layout.size(), QSafePoint(0U, 0U), outputVerifier); +#else + SafeWindow telltaleWindow(layout.size(), QSafePoint(0U, 0U)); +#endif + static SafeRenderer::StateManager stateManager(telltaleWindow, layout); + telltaleWindow.requestUpdate(); //Request is required because eventHandler is not running yet. + +#if defined(USE_OUTPUTVERIFIER) + EventHandler msgHandler(stateManager, telltaleWindow, outputVerifier); +#else + EventHandler msgHandler(stateManager, telltaleWindow); +#endif + +#if defined(HOST_BUILD) + //Mixing the Qt and Qt Safe Renderer renderers is done here only for demonstration purposes on host, not for production purposes of any kind. + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/main.qml")); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, qApp, + [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + qDebug() << "Failed to start the main.qml"; + }, Qt::QueuedConnection); + engine.addImportPath(":/imports"); + engine.load(url); +#endif + + msgHandler.handleEvents(); + + return 0; +} diff --git a/src/plugins/saferenderer/wizards/qsrapp/main.qml.tpl b/src/plugins/saferenderer/wizards/qsrapp/main.qml.tpl new file mode 100644 index 00000000000..94fccebcb2a --- /dev/null +++ b/src/plugins/saferenderer/wizards/qsrapp/main.qml.tpl @@ -0,0 +1,26 @@ +import Qt.SafeRenderer 2.0 +import QtQuick.Window 2.15 + +Window { + id: window + width: 640 + height: 480 + visible: true + title: qsTr("Hello QSR") + + SafeText { + id: safeText + objectName: "safetextitem" + x: 206 + y: 208 + width: 340 + height: 34 + color: "#8ae234" + fillColor: "black" + text: "Hello Qt Safe Renderer!" + font.family: "Lato" + horizontalAlignment: Text.AlignLeft + font.pixelSize: 32 + runtimeEditable: true + } +} diff --git a/src/plugins/saferenderer/wizards/qsrapp/qml.qrc.tpl b/src/plugins/saferenderer/wizards/qsrapp/qml.qrc.tpl new file mode 100644 index 00000000000..5f6483ac33f --- /dev/null +++ b/src/plugins/saferenderer/wizards/qsrapp/qml.qrc.tpl @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/src/plugins/saferenderer/wizards/qsrapp/safeasset.qrc.tpl b/src/plugins/saferenderer/wizards/qsrapp/safeasset.qrc.tpl new file mode 100644 index 00000000000..601b61fc4c2 --- /dev/null +++ b/src/plugins/saferenderer/wizards/qsrapp/safeasset.qrc.tpl @@ -0,0 +1,2 @@ + + diff --git a/src/plugins/saferenderer/wizards/qsrapp/wizard.json b/src/plugins/saferenderer/wizards/qsrapp/wizard.json new file mode 100644 index 00000000000..e05e5f7971a --- /dev/null +++ b/src/plugins/saferenderer/wizards/qsrapp/wizard.json @@ -0,0 +1,103 @@ +{ + "version": 1, + "supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ], + "id": "E.QSRApp", + "category": "D.QtSafeRendererApplication", + "trDescription": "Creates a Qt Safe Renderer project with simple UI and project setup.", + "trDisplayName": "Qt Safe Renderer Application", + "trDisplayCategory": "Application (Qt Safe Renderer)", + "icon": "../icon.png", + "iconKind": "Themed", + "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", + + "options": + [ + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') == 'qmake' ? value('ProFile') : value('CMakeFile')}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" }, + { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project", + "data": { "trDescription": "This wizard creates a simple Qt Safe Renderer application." } + }, + { + "trDisplayName": "Define Build System", + "trShortTitle": "Build System", + "typeId": "Fields", + "enabled": "%{JS: !value('IsSubproject')}", + "data": + [ + { + "name": "BuildSystem", + "trDisplayName": "Build system:", + "type": "ComboBox", + "persistenceKey": "BuildSystemType", + "data": + { + "index": 0, + "items": + [ + { + "trKey": "qmake", + "value": "qmake", + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" + } + ] + } + } + ] + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "enabled": "%{JS: !value('IsSubproject')}", + "data": { "projectFilePath": "%{ProjectFile}" } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "file.pro", + "target": "%{ProFile}", + "openAsProject": true, + "condition": "%{JS: value('BuildSystem') === 'qmake'}" + }, + { + "source": "main.cpp.tpl", + "target": "%{CppFileName}", + "openInEditor": false + }, + { + "source": "safeasset.qrc.tpl", + "target": "safeasset.qrc" + }, + { + "source": "qml.qrc.tpl", + "target": "qml.qrc" + }, + { + "source": "main.qml.tpl", + "target": "main.qml", + "openInEditor": true + } + ] + } + ] +} diff --git a/tests/auto/cplusplus/lexer/tst_lexer.cpp b/tests/auto/cplusplus/lexer/tst_lexer.cpp index a4c16bc8b07..641b62f248c 100644 --- a/tests/auto/cplusplus/lexer/tst_lexer.cpp +++ b/tests/auto/cplusplus/lexer/tst_lexer.cpp @@ -442,6 +442,7 @@ void tst_SimpleLexer::ppOpOrPunc() const QByteArray source = QTest::currentDataTag(); LanguageFeatures languageFeatures; languageFeatures.cxxEnabled = true; + languageFeatures.cxx20Enabled = true; run(source, toTokens({unsigned(expectedTokenKind)}), false, CompareKind, true, languageFeatures); } @@ -492,6 +493,7 @@ void tst_SimpleLexer::ppOpOrPunc_data() QTest::newRow("==") << T_EQUAL_EQUAL; QTest::newRow("!=") << T_EXCLAIM_EQUAL; QTest::newRow("<=") << T_LESS_EQUAL; + QTest::newRow("<=>") << T_LESS_EQUAL_GREATER; QTest::newRow(">=") << T_GREATER_EQUAL; QTest::newRow("&&") << T_AMPER_AMPER; QTest::newRow("||") << T_PIPE_PIPE;