diff --git a/dist/changelog/changes-12.0.0.md b/dist/changelog/changes-12.0.0.md index dd6606dccaf..69ab50ee436 100644 --- a/dist/changelog/changes-12.0.0.md +++ b/dist/changelog/changes-12.0.0.md @@ -145,6 +145,12 @@ Editing ### QML +* Fixed multiple crashes when updating the `Outline` view + ([QTCREATORBUG-28862](https://bugreports.qt.io/browse/QTCREATORBUG-28862), + [QTCREATORBUG-29653](https://bugreports.qt.io/browse/QTCREATORBUG-29653), + [QTCREATORBUG-29702](https://bugreports.qt.io/browse/QTCREATORBUG-29702)) +* Fixed that reformatting QML code removed type annotations + ([QTCREATORBUG-29061](https://bugreports.qt.io/browse/QTCREATORBUG-29061)) * Fixed invalid `M325` warnings ([QTCREATORBUG-29601](https://bugreports.qt.io/browse/QTCREATORBUG-29601)) * Language Server @@ -237,6 +243,8 @@ Projects * Fixed issues with the subdirectory structure of the project tree ([QTCREATORBUG-23942](https://bugreports.qt.io/browse/QTCREATORBUG-23942), [QTCREATORBUG-29105](https://bugreports.qt.io/browse/QTCREATORBUG-29105)) +* Fixed an issue with source file specific compiler flags + ([QTCREATORBUG-29707](https://bugreports.qt.io/browse/QTCREATORBUG-29707)) * Presets * Fixed that variables were not expanded for `cmakeExecutable` ([QTCREATORBUG-29643](https://bugreports.qt.io/browse/QTCREATORBUG-29643)) @@ -258,6 +266,11 @@ Projects * Fixed the project tree structure in case of some subfolder structures ([QTCREATORBUG-29733](https://bugreports.qt.io/browse/QTCREATORBUG-29733)) +### Qbs + +* Fixed the importing of builds on macOS + ([QTCREATORBUG-29829](https://bugreports.qt.io/browse/QTCREATORBUG-29829)) + ### vcpkg * Added the generation of code for `CMakeLists.txt` @@ -279,6 +292,11 @@ Debugging * Added support for remote Linux debugging with LLDB * Fixed warnings about index cache permissions ([QTCREATORBUG-29556](https://bugreports.qt.io/browse/QTCREATORBUG-29556)) +* Pretty Printers + * Fixed `QDateTime` with a time zone offset + ([QTCREATORBUG-29737](https://bugreports.qt.io/browse/QTCREATORBUG-29737)) + * Fixed `std::unique_ptr` on macOS + * Fixed `QImage` Analyzer -------- @@ -325,10 +343,17 @@ Test Integration * Added an option for the number of threads used for scanning ([QTCREATORBUG-29301](https://bugreports.qt.io/browse/QTCREATORBUG-29301)) * Improved the wizards for `GTest` and `Catch2` +* CTest + * Enabled colored test output Platforms --------- +### macOS + +* Fixed running and debugging in an external terminal + ([QTCREATORBUG-29246](https://bugreports.qt.io/browse/QTCREATORBUG-29246)) + ### Android * Fixed issues when `LIBRARY_OUTPUT_DIRECTORY` is set in the CMake build files diff --git a/doc/qtcreator/src/ios/creator-ios-dev.qdoc b/doc/qtcreator/src/ios/creator-ios-dev.qdoc index 579e0651740..6c9ca24dfea 100644 --- a/doc/qtcreator/src/ios/creator-ios-dev.qdoc +++ b/doc/qtcreator/src/ios/creator-ios-dev.qdoc @@ -11,6 +11,8 @@ You can connect iOS devices to your local machine with a USB cable to run applications built for them from \QC. + \note Deployment, running, and debugging on iOS 17 devices are not supported. + To be able to use \QC on \macos, you must install Xcode, and therefore, you already have the tool chain for building applications for iOS. \QC automatically detects the tool chain and creates the necessary diff --git a/doc/qtcreator/src/overview/creator-only/creator-mobile-platforms.qdoc b/doc/qtcreator/src/overview/creator-only/creator-mobile-platforms.qdoc index 5b3fbeaecc8..f563a69e382 100644 --- a/doc/qtcreator/src/overview/creator-only/creator-mobile-platforms.qdoc +++ b/doc/qtcreator/src/overview/creator-only/creator-mobile-platforms.qdoc @@ -48,6 +48,8 @@ \section1 iOS + \note Deployment, running, and debugging on iOS 17 devices are not supported. + To be able to use \QC on \macos, you must install Xcode, and therefore you should already have the tool chain for building applications for iOS. \QC automatically detects the tool chain and creates the necessary diff --git a/doc/qtcreator/src/overview/creator-only/creator-supported-platforms.qdoc b/doc/qtcreator/src/overview/creator-only/creator-supported-platforms.qdoc index 5ea6d94a0cf..784dccad4b8 100644 --- a/doc/qtcreator/src/overview/creator-only/creator-supported-platforms.qdoc +++ b/doc/qtcreator/src/overview/creator-only/creator-supported-platforms.qdoc @@ -69,8 +69,7 @@ \li \image ok.png \endtable - \note UWP support was removed from \QC 8.0. - To develop for UWP using Qt 5, use \QC 7.0, or earlier. + \note Deployment, running, and debugging on iOS 17 devices are not supported. \QC automatically runs scheduled checks for updates based on the settings specified in \preferences > \uicontrol Environment > \uicontrol Update. diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index d2891451e95..008968afc46 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -1282,6 +1282,10 @@ protected: out(ast->rparenToken); if (ast->isArrowFunction && !ast->formals) out("()"); + if (ast->typeAnnotation) { + out(": "); + out(ast->typeAnnotation->type->toString()); + } out(" "); if (ast->isArrowFunction) out("=> "); @@ -1406,6 +1410,10 @@ protected: { for (FormalParameterList *it = ast; it; it = it->next) { accept(it->element); + if (it->element->typeAnnotation) { + out(": "); + out(it->element->typeAnnotation->type->toString()); + } if (it->next) out(", "); } diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp index a66bf2846a6..de1a7557c83 100644 --- a/src/plugins/boot2qt/qdbplugin.cpp +++ b/src/plugins/boot2qt/qdbplugin.cpp @@ -124,31 +124,7 @@ public: && prj->hasMakeInstallEquivalent(); }); addInitialStep(Qdb::Constants::QdbStopApplicationStepId); - addInitialStep(RemoteLinux::Constants::GenericDeployStepId, [](Target *target) { - auto device = DeviceKitAspect::device(target->kit()); - auto buildDevice = BuildDeviceKitAspect::device(target->kit()); - if (buildDevice && buildDevice->rootPath().needsDevice()) - return false; - return !device || (device - && device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool()); - }); - addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) { - auto device = DeviceKitAspect::device(target->kit()); - auto buildDevice = BuildDeviceKitAspect::device(target->kit()); - if (buildDevice && buildDevice->rootPath().needsDevice()) - return false; - return device && !device->extraData(ProjectExplorer::Constants::SUPPORTS_RSYNC).toBool(); - }); - // This step is for: - // a) A remote build device, as they do not support real rsync yet. - // b) If there is no target device setup yet. - addInitialStep(RemoteLinux::Constants::DirectUploadStepId, [](Target *target) { - auto device = DeviceKitAspect::device(target->kit()); - auto buildDevice = BuildDeviceKitAspect::device(target->kit()); - if (buildDevice && buildDevice->rootPath().needsDevice()) - return true; - return false; - }); + addInitialStep(RemoteLinux::Constants::GenericDeployStepId); } }; diff --git a/src/plugins/clangtools/clangtoolrunner.cpp b/src/plugins/clangtools/clangtoolrunner.cpp index d6ddae635b2..8769fa5cf78 100644 --- a/src/plugins/clangtools/clangtoolrunner.cpp +++ b/src/plugins/clangtools/clangtoolrunner.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -76,14 +77,17 @@ static QStringList checksArguments(const AnalyzeInputData &input) return {}; } -static QStringList clangArguments(const ClangDiagnosticConfig &diagnosticConfig, - const QStringList &baseOptions) +static QStringList clangArguments(const AnalyzeInputData &input) { QStringList arguments; + const ClangDiagnosticConfig &diagnosticConfig = input.config; + const QStringList &baseOptions = input.unit.arguments; arguments << ClangDiagnosticConfigsModel::globalDiagnosticOptions() << (isClMode(baseOptions) ? clangArgsForCl(diagnosticConfig.clangOptions()) : diagnosticConfig.clangOptions()) << baseOptions; + if (ProjectFile::isHeader(input.unit.file)) + arguments << "-Wno-pragma-once-outside-header"; if (LOG().isDebugEnabled()) arguments << QLatin1String("-v"); @@ -157,7 +161,7 @@ GroupItem clangToolTask(const AnalyzeInputData &input, const QStringList args = checksArguments(input) + mainToolArguments(data) + QStringList{"--"} - + clangArguments(input.config, input.unit.arguments); + + clangArguments(input); const CommandLine commandLine = {data.executable, args}; qCDebug(LOG).noquote() << "Starting" << commandLine.toUserOutput(); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 6262a9342e6..edf30ab645a 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -1789,7 +1789,7 @@ void CMakeBuildSystem::updateQmlJSCodeModel(const QStringList &extraHeaderPaths, auto addImports = [&projectInfo](const QString &imports) { const QStringList importList = CMakeConfigItem::cmakeSplitValue(imports); for (const QString &import : importList) - projectInfo.importPaths.maybeInsert(FilePath::fromString(import), QmlJS::Dialect::Qml); + projectInfo.importPaths.maybeInsert(FilePath::fromUserInput(import), QmlJS::Dialect::Qml); }; const CMakeConfig &cm = configurationFromCMake(); diff --git a/src/plugins/compilerexplorer/compilerexplorereditor.cpp b/src/plugins/compilerexplorer/compilerexplorereditor.cpp index 14679d48b6a..5f8f218ab5e 100644 --- a/src/plugins/compilerexplorer/compilerexplorereditor.cpp +++ b/src/plugins/compilerexplorer/compilerexplorereditor.cpp @@ -209,14 +209,17 @@ SourceEditorWidget::SourceEditorWidget(const std::shared_ptr &se connect(m_codeEditor, &CodeEditorWidget::gotFocus, this, &SourceEditorWidget::gotFocus); - TextDocumentPtr document = TextDocumentPtr(new SourceTextDocument(m_sourceSettings, undoStack)); + auto sourceTextDocument = settings->sourceTextDocument(); + if (!sourceTextDocument) + sourceTextDocument = TextDocumentPtr(new SourceTextDocument(m_sourceSettings, undoStack)); + settings->setSourceTextDocument(sourceTextDocument); - connect(document.get(), + connect(sourceTextDocument.get(), &SourceTextDocument::changed, this, &SourceEditorWidget::sourceCodeChanged); - m_codeEditor->setTextDocument(document); + m_codeEditor->setTextDocument(sourceTextDocument); m_codeEditor->updateHighlighter(); auto addCompilerButton = new QToolButton; diff --git a/src/plugins/compilerexplorer/compilerexplorersettings.h b/src/plugins/compilerexplorer/compilerexplorersettings.h index 64f67122fe6..dc32dbd8c2d 100644 --- a/src/plugins/compilerexplorer/compilerexplorersettings.h +++ b/src/plugins/compilerexplorer/compilerexplorersettings.h @@ -8,6 +8,8 @@ #include +#include + #include namespace CompilerExplorer { @@ -58,6 +60,12 @@ public: ApiConfigFunction apiConfigFunction() const { return m_apiConfigFunction; } + TextEditor::TextDocumentPtr sourceTextDocument() const { return m_sourceTextDocument; } + void setSourceTextDocument(TextEditor::TextDocumentPtr sourceTextDocument) + { + m_sourceTextDocument = sourceTextDocument; + } + public: Utils::StringSelectionAspect languageId{this}; Utils::StringAspect source{this}; @@ -75,6 +83,7 @@ private: private: CompilerExplorerSettings *m_parent; ApiConfigFunction m_apiConfigFunction; + TextEditor::TextDocumentPtr m_sourceTextDocument{nullptr}; }; class CompilerSettings : public Utils::AspectContainer, diff --git a/src/plugins/debugger/dap/dapengine.cpp b/src/plugins/debugger/dap/dapengine.cpp index 18171f7217b..04025fd78fc 100644 --- a/src/plugins/debugger/dap/dapengine.cpp +++ b/src/plugins/debugger/dap/dapengine.cpp @@ -867,7 +867,7 @@ void DapEngine::refreshLocals(const QJsonArray &variables) if (currentItem && currentItem->iname.startsWith("watch")) currentItem->removeChildren(); - for (const QJsonValueConstRef &variable : variables) { + for (const auto &variable : variables) { WatchItem *item = new WatchItem; const QString name = variable.toObject().value("name").toString(); diff --git a/src/plugins/projectexplorer/headerpath.h b/src/plugins/projectexplorer/headerpath.h index f46d1ad401e..6df25245424 100644 --- a/src/plugins/projectexplorer/headerpath.h +++ b/src/plugins/projectexplorer/headerpath.h @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -22,7 +23,8 @@ class HeaderPath { public: HeaderPath() = default; - HeaderPath(const QString &path, HeaderPathType type) : path(path), type(type) { } + HeaderPath(const QString &path, HeaderPathType type) + : path(QDir::fromNativeSeparators(path)), type(type) { } HeaderPath(const char *path, HeaderPathType type) : HeaderPath(QLatin1String(path), type) {} HeaderPath(const Utils::FilePath &path, HeaderPathType type) : HeaderPath(path.path(), type) diff --git a/src/plugins/qtsupport/codegensettings.cpp b/src/plugins/qtsupport/codegensettings.cpp index 007467e619d..ec956dc09bb 100644 --- a/src/plugins/qtsupport/codegensettings.cpp +++ b/src/plugins/qtsupport/codegensettings.cpp @@ -41,7 +41,6 @@ CodeGenSettings::CodeGenSettings() addQtVersionCheck.setSettingsKey("AddQtVersionCheck"); addQtVersionCheck.setLabelText(Tr::tr("Add Qt version #ifdef for module names")); - addQtVersionCheck.setEnabler(&includeQtModule); setLayouter([this] { using namespace Layouting; @@ -66,6 +65,7 @@ CodeGenSettings::CodeGenSettings() readSettings(); + addQtVersionCheck.setEnabler(&includeQtModule); } class CodeGenSettingsPage final : public Core::IOptionsPage diff --git a/tests/auto/qml/reformatter/tst_reformatter.cpp b/tests/auto/qml/reformatter/tst_reformatter.cpp index 36c8f2a83e8..748b8b81263 100644 --- a/tests/auto/qml/reformatter/tst_reformatter.cpp +++ b/tests/auto/qml/reformatter/tst_reformatter.cpp @@ -28,6 +28,11 @@ public: private slots: void test(); void test_data(); + + void reformatter_data(); + void reformatter(); + +private: }; tst_Reformatter::tst_Reformatter() @@ -41,10 +46,18 @@ void tst_Reformatter::test_data() { QTest::addColumn("path"); + // This test performs line-by-line comparison and fails if reformatting + // makes a change inline, for example whitespace removal. We omit + // those files in this test. + QSet excludedFiles; + excludedFiles << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.qml"; + excludedFiles << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.formatted.qml"; + QDirIterator it(TESTSRCDIR, QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"), QDir::Files); while (it.hasNext()) { const QString fileName = it.next(); - QTest::newRow(fileName.toLatin1()) << it.filePath(); + if (!excludedFiles.contains(fileName)) + QTest::newRow(fileName.toLatin1()) << it.filePath(); } } @@ -84,6 +97,44 @@ void tst_Reformatter::test() QCOMPARE(sourceLines.size(), newLines.size()); } +void tst_Reformatter::reformatter_data() +{ + QTest::addColumn("filePath"); + QTest::addColumn("formattedFilePath"); + + QTest::newRow("typeAnnotations") + << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.qml" + << QString::fromLatin1(TESTSRCDIR) + QDir::separator() + "typeAnnotations.formatted.qml"; +} + +void tst_Reformatter::reformatter() +{ + QFETCH(QString, filePath); + QFETCH(QString, formattedFilePath); + + Utils::FilePath fPath = Utils::FilePath::fromString(filePath); + Document::MutablePtr doc + = Document::create(fPath, ModelManagerInterface::guessLanguageOfFile(fPath)); + + QString fileContent; + { + QFile file(filePath); + QVERIFY(file.open(QFile::ReadOnly | QFile::Text)); + fileContent = QString::fromUtf8(file.readAll()); + } + doc->setSource(fileContent); + doc->parse(); + QString expected; + { + QFile file(formattedFilePath); + QVERIFY(file.open(QFile::ReadOnly | QFile::Text)); + expected = QString::fromUtf8(file.readAll()); + } + + QString formatted = reformat(doc); + QCOMPARE(formatted, expected); +} + QTEST_GUILESS_MAIN(tst_Reformatter); #include "tst_reformatter.moc" diff --git a/tests/auto/qml/reformatter/typeAnnotations.formatted.qml b/tests/auto/qml/reformatter/typeAnnotations.formatted.qml new file mode 100644 index 00000000000..208aa25cd9a --- /dev/null +++ b/tests/auto/qml/reformatter/typeAnnotations.formatted.qml @@ -0,0 +1,18 @@ + +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +import QtQuick + +Text { + function aaa(t: int, k: double): int { + return 42 + } + + function bbb(aaa): int { + return 42 + } + + function abc(cba: int) { + return 42 + } +} diff --git a/tests/auto/qml/reformatter/typeAnnotations.qml b/tests/auto/qml/reformatter/typeAnnotations.qml new file mode 100644 index 00000000000..af0d93b3de7 --- /dev/null +++ b/tests/auto/qml/reformatter/typeAnnotations.qml @@ -0,0 +1,17 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick + +Text { + function aaa (t : int, k : double) : int { + return 42; + } + + function bbb(aaa) + : int {return 42} + + function abc (cba : int) { + return 42; + } +} diff --git a/tests/manual/terminal/CMakeLists.txt b/tests/manual/terminal/CMakeLists.txt index f4fff9d2c43..409cba4d706 100644 --- a/tests/manual/terminal/CMakeLists.txt +++ b/tests/manual/terminal/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_test(tst_terminal + MANUALTEST DEPENDS Utils SOURCES tst_terminal.cpp ) diff --git a/tests/manual/terminal/terminal.qbs b/tests/manual/terminal/terminal.qbs index 4b7a408a1e4..a9bea16872f 100644 --- a/tests/manual/terminal/terminal.qbs +++ b/tests/manual/terminal/terminal.qbs @@ -1,6 +1,6 @@ import qbs -QtcAutotest { +QtcManualTest { name: "Terminal autotest" Depends { name: "Utils" } files: "tst_terminal.cpp"