From 503fd8121d6030680d8727dbbdc540b5615e4357 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 8 Nov 2023 09:32:02 +0100 Subject: [PATCH 01/11] Terminal: Make test actually manual Change-Id: Ib44111401c4b4e1f16c8c53b6bd1f323f725cdd1 Reviewed-by: Cristian Adam --- tests/manual/terminal/CMakeLists.txt | 1 + tests/manual/terminal/terminal.qbs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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" From 2eb73350abba6d5e57af2f546a3dc4afb2aa5492 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Thu, 19 Oct 2023 16:11:31 +0300 Subject: [PATCH 02/11] boot2qt: always use GenericUpload GenericUpload knows if sftp or rsync can be used. Change-Id: I6f6d478f2da9659777cc5046b4425ae025fdca0a Reviewed-by: hjk --- src/plugins/boot2qt/qdbplugin.cpp | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) 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); } }; From 210907529f74bce29e8938445276634f2e010a54 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 8 Nov 2023 09:06:25 +0100 Subject: [PATCH 03/11] QtSupport: Fix order of setEnabler / readSettings Silences a soft assert. Change-Id: Ibd32f2efe75f610bf7e8f6a33a7a84a8da9f7019 Reviewed-by: Marcus Tillmanns --- src/plugins/qtsupport/codegensettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From df360704f00a4274cc7c616b91302bf1fae8b8e8 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 6 Nov 2023 17:30:38 +0100 Subject: [PATCH 04/11] ClangTools: Suppress bogus clazy warning about #pragma once We don't pass the correct value "c++header" to the -x option, because to clang that implies building a precompiled header, which apparently switches on some different mode that breaks clang-tidy and clazy. On the other hand, with "-x c++" clazy now thinks that this is a source file and frowns at "#pragma once". Suppress this warning for header files. Amends 60fca0596adfc98af9e3ef4e657d90eec4af9486. We might run into similar "header vs source" problems in the future. I don't see anything better than suppressing them one by one. Fixes: QTCREATORBUG-29781 Change-Id: Ia15ac5b278777e2b2e089e9d58bb7537c38955ce Reviewed-by: David Schulz --- src/plugins/clangtools/clangtoolrunner.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/clangtools/clangtoolrunner.cpp b/src/plugins/clangtools/clangtoolrunner.cpp index e83037aa536..23c249d3489 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(); From ffcbbecf271d23830dbe0515586044ffc05f2fc2 Mon Sep 17 00:00:00 2001 From: Semih Yavuz Date: Sat, 6 May 2023 17:06:17 +0200 Subject: [PATCH 05/11] reformatter: Do not remove type annotations Type annotations were being removed by the reformat action. Write out the relavant annotations in ast to fix it. Add exclusion mechanism in tst_qml_reformatter test since it performs line by line comparison which doesn't fit all reformatting cases. Introduce char-by-char data tests. Fixes: QTCREATORBUG-29061 Change-Id: Ia52b51e6d7d938bdec325c4f426b11c722f85f8e Reviewed-by: Ulf Hermann --- src/libs/qmljs/qmljsreformatter.cpp | 8 +++ .../auto/qml/reformatter/tst_reformatter.cpp | 53 ++++++++++++++++++- .../reformatter/typeAnnotations.formatted.qml | 18 +++++++ .../auto/qml/reformatter/typeAnnotations.qml | 17 ++++++ 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 tests/auto/qml/reformatter/typeAnnotations.formatted.qml create mode 100644 tests/auto/qml/reformatter/typeAnnotations.qml 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/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; + } +} From e48d365b199c6a6264c4ae28978d7798b6467ca5 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 7 Nov 2023 15:47:03 +0100 Subject: [PATCH 06/11] ProjectExplorer: Normalize separators on HeaderPath construction Fixes a Windows test failure in CompilationDatabaseProjectManager. Change-Id: Ic373b7a50b1374be4cf028fc304442c3cf077735 Reviewed-by: Christian Stenger --- src/plugins/projectexplorer/headerpath.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) From a02766431b92ef847a76a331f7a56328248d571b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 8 Nov 2023 14:49:23 +0100 Subject: [PATCH 07/11] Update change log for 12.0.0 Change-Id: Ia105b80002652f9f37b2e41cb13afe439713af9f Reviewed-by: Leena Miettinen --- dist/changelog/changes-12.0.0.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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 From 2f664c4c3def6e34b98644105df13fd6071adfb6 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 30 Oct 2023 16:43:00 +0100 Subject: [PATCH 08/11] Doc: Add a note about iOS support being broken in version 12.0 Task-number: QTCREATORBUG-29392 Change-Id: Iede2437b370971c595df2ddca6a0cb544550b1c3 Reviewed-by: Eike Ziller --- doc/qtcreator/src/ios/creator-ios-dev.qdoc | 2 ++ .../src/overview/creator-only/creator-mobile-platforms.qdoc | 2 ++ .../src/overview/creator-only/creator-supported-platforms.qdoc | 3 +-- 3 files changed, 5 insertions(+), 2 deletions(-) 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. From e4805b88c9835bf6dfa258cdbaf5bfe89cd27fa2 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 8 Nov 2023 15:31:06 +0100 Subject: [PATCH 09/11] CMakePM: Use FilePath::fromUserInput Change-Id: I748fc41ed380c907b6edcca3a1802a47f9f74436 Reviewed-by: Cristian Adam --- src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 238cf87b712..febb130a0ac 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -1792,7 +1792,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(); From 6e1d7fc961d966c973e5db796e5b0f4f25f05fb8 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 8 Nov 2023 16:47:21 +0100 Subject: [PATCH 10/11] CompilerExplorer: Fix crash on undo We need to store the source text document so that when the editor is remove and the user triggers undo/read, the pointer is still valid. Change-Id: I571906db1c4424455172a42d72351cd9ba1e7c03 Reviewed-by: David Schulz --- src/plugins/compilerexplorer/compilerexplorereditor.cpp | 9 ++++++--- src/plugins/compilerexplorer/compilerexplorersettings.h | 9 +++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/plugins/compilerexplorer/compilerexplorereditor.cpp b/src/plugins/compilerexplorer/compilerexplorereditor.cpp index f71010744ef..25c096c20d9 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, From 4436e96f91e934473308b5115a3052a650d77e57 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 9 Nov 2023 06:55:30 +0100 Subject: [PATCH 11/11] Debugger: Fix compile with Qt6.2 Amends 43f99cb53b0943926753f8d7c7f695a07a1fb8a6. Change-Id: Ia28b129f761e8cfe6dd3a908ccfcf50d043d1639 Reviewed-by: Marcus Tillmanns --- src/plugins/debugger/dap/dapengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/dap/dapengine.cpp b/src/plugins/debugger/dap/dapengine.cpp index 33cc0d9ae37..8dcbb89dd7e 100644 --- a/src/plugins/debugger/dap/dapengine.cpp +++ b/src/plugins/debugger/dap/dapengine.cpp @@ -815,7 +815,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();