From ce1a547b6cbfd875d2996ee71b9aa8f7327262aa Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Mon, 2 Jan 2023 11:43:18 +0100 Subject: [PATCH 1/7] CodeStyle: Fix preview update Fixes: QTCREATORBUG-28621 Change-Id: I66a66d9c16933ebd8197f9e286e72dce7a621933 Reviewed-by: Reviewed-by: David Schulz --- .../cppeditor/cppcodestylesettingspage.cpp | 31 ++++++++++++++----- .../cppeditor/cppcodestylesettingspage.h | 4 ++- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/plugins/cppeditor/cppcodestylesettingspage.cpp b/src/plugins/cppeditor/cppcodestylesettingspage.cpp index 67a785809d5..3fc0a3ba875 100644 --- a/src/plugins/cppeditor/cppcodestylesettingspage.cpp +++ b/src/plugins/cppeditor/cppcodestylesettingspage.cpp @@ -165,6 +165,9 @@ void CppCodeStylePreferencesWidget::setCodeStyle(CppCodeStylePreferences *codeSt setCodeStyleSettings(m_preferences->currentCodeStyleSettings(), false); slotCurrentPreferencesChanged(m_preferences->currentPreferences(), false); + m_originalCppCodeStyleSettings = cppCodeStyleSettings(); + m_originalTabSettings = tabSettings(); + updatePreview(); } @@ -253,6 +256,12 @@ void CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged() if (m_blockUpdates) return; + if (m_preferences) { + auto current = qobject_cast(m_preferences->currentPreferences()); + if (current) + current->setCodeStyleSettings(cppCodeStyleSettings()); + } + emit codeStyleSettingsChanged(cppCodeStyleSettings()); updatePreview(); } @@ -262,6 +271,12 @@ void CppCodeStylePreferencesWidget::slotTabSettingsChanged(const TabSettings &se if (m_blockUpdates) return; + if (m_preferences) { + auto current = qobject_cast(m_preferences->currentPreferences()); + if (current) + current->setTabSettings(settings); + } + emit tabSettingsChanged(settings); updatePreview(); } @@ -344,19 +359,21 @@ void CppCodeStylePreferencesWidget::addTab(CppCodeStyleWidget *page, QString tab void CppCodeStylePreferencesWidget::apply() { - if (m_preferences) { - auto current = qobject_cast(m_preferences->currentPreferences()); - if (current) { - current->setTabSettings(tabSettings()); - current->setCodeStyleSettings(cppCodeStyleSettings()); - } - } + m_originalTabSettings = tabSettings(); + m_originalCppCodeStyleSettings = cppCodeStyleSettings(); emit applyEmitted(); } void CppCodeStylePreferencesWidget::finish() { + if (m_preferences) { + auto current = qobject_cast(m_preferences->currentDelegate()); + if (current) { + current->setCodeStyleSettings(m_originalCppCodeStyleSettings); + current->setTabSettings(m_originalTabSettings); + } + } emit finishEmitted(); } diff --git a/src/plugins/cppeditor/cppcodestylesettingspage.h b/src/plugins/cppeditor/cppcodestylesettingspage.h index 844cfc0337e..01a7860a190 100644 --- a/src/plugins/cppeditor/cppcodestylesettingspage.h +++ b/src/plugins/cppeditor/cppcodestylesettingspage.h @@ -8,13 +8,13 @@ #include #include +#include #include #include namespace TextEditor { class FontSettings; - class TabSettings; class SnippetEditorWidget; class CodeStyleEditor; class CodeStyleEditorWidget; @@ -72,6 +72,8 @@ private: CppCodeStylePreferences *m_preferences = nullptr; Ui::CppCodeStyleSettingsPage *m_ui; QList m_previews; + CppCodeStyleSettings m_originalCppCodeStyleSettings; + TextEditor::TabSettings m_originalTabSettings; bool m_blockUpdates = false; signals: void codeStyleSettingsChanged(const CppEditor::CppCodeStyleSettings &); From adc874f6902efd3cda953d21905e495119247104 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 5 Jan 2023 11:40:25 +0100 Subject: [PATCH 2/7] COIN/GitHub: Use Qt 6.4.2 Change-Id: Ia66ce7e0a8ebf988c1af9888ddb7e9461f0cac05 Reviewed-by: Reviewed-by: Qt CI Bot Reviewed-by: Cristian Adam Reviewed-by: David Schulz --- .github/workflows/build_cmake.yml | 5 +++-- coin/instructions/common_environment.yaml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index d695061f95d..e430f35ebde 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -7,7 +7,8 @@ on: - 'doc/**' env: - QT_VERSION: 6.4.0 + QT_VERSION: 6.4.2 + MACOS_DEPLOYMENT_TARGET: 10.14 CLANG_VERSION: 15.0.0 ELFUTILS_VERSION: 0.175 CMAKE_VERSION: 3.21.1 @@ -489,7 +490,7 @@ jobs: run: | set(ENV{CC} ${{ matrix.config.cc }}) set(ENV{CXX} ${{ matrix.config.cxx }}) - set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.13") + set(ENV{MACOSX_DEPLOYMENT_TARGET} "${{ env.MACOS_DEPLOYMENT_TARGET }}") if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") execute_process( diff --git a/coin/instructions/common_environment.yaml b/coin/instructions/common_environment.yaml index 5843ca790b0..33557ea11d5 100644 --- a/coin/instructions/common_environment.yaml +++ b/coin/instructions/common_environment.yaml @@ -10,7 +10,7 @@ instructions: variableValue: http://master.qt.io/development_releases/prebuilt/libclang/libclang-release_15.0.0-based - type: EnvironmentVariable variableName: QTC_QT_BASE_URL - variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.4/6.4.0-released/Qt" + variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.4/6.4.2-released/Qt" - type: EnvironmentVariable variableName: QTC_QT_MODULES variableValue: "qt5compat qtbase qtdeclarative qtimageformats qtquick3d qtquickcontrols2 qtquicktimeline qtserialport qtshadertools qtsvg qttools qttranslations qtwebengine" From c7bb5fcc37edcc2ae7de8c0377bbd517936325fa Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 6 Jan 2023 09:14:09 +0100 Subject: [PATCH 3/7] Debugger: Remove spurious waring Task-number: QTCREATORBUG-27160 Change-Id: Ie69c60688249efcd4d2c2330d6555cf7f708edd2 Reviewed-by: Eike Ziller --- share/qtcreator/debugger/dumper.py | 1 - 1 file changed, 1 deletion(-) diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 8beba72113a..85deeba1c82 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -239,7 +239,6 @@ class DumperBase(): def setFallbackQtVersion(self, args): version = int(args.get('version', self.fallbackQtVersion)) - DumperBase.warn("got fallback qt version 0x%x" % version) self.fallbackQtVersion = version def resetPerStepCaches(self): From a3153c535d7e9e64fab530d86e64ab76ef4988e0 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Fri, 16 Dec 2022 19:20:33 +0100 Subject: [PATCH 4/7] CMakePM: Add default kit configuration hashing This adds a QTC_KIT_DEFAULT_CONFIG_HASH variable containing the hash of all the default Qt Creator CMake kit variables: * CMAKE_C_COMPILER * CMAKE_CXX_COMPILER * QT_QMAKE_EXECUTABLE * CMAKE_PREFIX_PATH This way when a CMake preset changes any of these CMake variables a new Kit will be created. Otherwise a previous kit containing different values will be used. Fixes: QTCREATORBUG-28609 Change-Id: I77b67e9c8fa15dc3ff2f22c5b63d4ca1c7670fdc Reviewed-by: Reviewed-by: Alessandro Portale --- .../cmakekitinformation.cpp | 39 +++++++++++++++++++ .../cmakeprojectmanager/cmakekitinformation.h | 4 ++ .../cmakeprojectimporter.cpp | 34 ++++++++++------ 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index 32a00daf5b0..6e7638e2d03 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -875,6 +876,7 @@ const char CMAKE_CXX_TOOLCHAIN_KEY[] = "CMAKE_CXX_COMPILER"; const char CMAKE_QMAKE_KEY[] = "QT_QMAKE_EXECUTABLE"; const char CMAKE_PREFIX_PATH_KEY[] = "CMAKE_PREFIX_PATH"; const char QTC_CMAKE_PRESET_KEY[] = "QTC_CMAKE_PRESET"; +const char QTC_KIT_DEFAULT_CONFIG_HASH[] = "QTC_KIT_DEFAULT_CONFIG_HASH"; class CMakeConfigurationKitAspectWidget final : public KitAspectWidget { @@ -1135,6 +1137,43 @@ CMakeConfigItem CMakeConfigurationKitAspect::cmakePresetConfigItem(const Project }); } +void CMakeConfigurationKitAspect::setKitDefaultConfigHash(ProjectExplorer::Kit *k) +{ + const CMakeConfig defaultConfigExpanded + = Utils::transform(defaultConfiguration(k).toList(), [k](const CMakeConfigItem &item) { + CMakeConfigItem expanded(item); + expanded.value = item.expandedValue(k).toUtf8(); + return expanded; + }); + const QByteArray kitHash = computeDefaultConfigHash(defaultConfigExpanded); + + CMakeConfig config = configuration(k); + config.append(CMakeConfigItem(QTC_KIT_DEFAULT_CONFIG_HASH, CMakeConfigItem::INTERNAL, kitHash)); + + setConfiguration(k, config); +} + +CMakeConfigItem CMakeConfigurationKitAspect::kitDefaultConfigHashItem(const ProjectExplorer::Kit *k) +{ + const CMakeConfig config = configuration(k); + return Utils::findOrDefault(config, [](const CMakeConfigItem &item) { + return item.key == QTC_KIT_DEFAULT_CONFIG_HASH; + }); +} + +QByteArray CMakeConfigurationKitAspect::computeDefaultConfigHash(const CMakeConfig &config) +{ + const CMakeConfig defaultConfig = defaultConfiguration(nullptr); + const QByteArray configValues = std::accumulate(defaultConfig.begin(), + defaultConfig.end(), + QByteArray(), + [config](QByteArray &sum, + const CMakeConfigItem &item) { + return sum += config.valueOf(item.key); + }); + return QCryptographicHash::hash(configValues, QCryptographicHash::Md5).toHex(); +} + QVariant CMakeConfigurationKitAspect::defaultValue(const Kit *k) const { // FIXME: Convert preload scripts diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.h b/src/plugins/cmakeprojectmanager/cmakekitinformation.h index da2435664b3..25b7b7f3f7d 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.h +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.h @@ -91,6 +91,10 @@ public: static void setCMakePreset(ProjectExplorer::Kit *k, const QString &presetName); static CMakeConfigItem cmakePresetConfigItem(const ProjectExplorer::Kit *k); + static void setKitDefaultConfigHash(ProjectExplorer::Kit *k); + static CMakeConfigItem kitDefaultConfigHashItem(const ProjectExplorer::Kit *k); + static QByteArray computeDefaultConfigHash(const CMakeConfig &config); + // KitAspect interface ProjectExplorer::Tasks validate(const ProjectExplorer::Kit *k) const final; void setup(ProjectExplorer::Kit *k) final; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index fe9487bbaf6..b2e0e6f12df 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -46,6 +46,7 @@ struct DirectoryData QString cmakePresetDisplayname; QString cmakePreset; + QByteArray cmakePresetDefaultConfigHash; // Kit Stuff FilePath cmakeBinary; @@ -549,6 +550,8 @@ QList CMakeProjectImporter::examineDirectory(const FilePath &importPath, CMakeConfigItem::STRING, configurePreset.generator.value().toUtf8()); } + data->cmakePresetDefaultConfigHash = CMakeConfigurationKitAspect::computeDefaultConfigHash( + config); const FilePath qmake = qmakeFromCMakeCache(config); if (!qmake.isEmpty()) @@ -685,8 +688,16 @@ bool CMakeProjectImporter::matchKit(void *directoryData, const Kit *k) const bool haveCMakePreset = false; if (!data->cmakePreset.isEmpty()) { - auto presetConfigItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(k); - if (data->cmakePreset != presetConfigItem.expandedValue(k)) + const auto presetConfigItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(k); + const auto kitConfigHashItem = CMakeConfigurationKitAspect::kitDefaultConfigHashItem(k); + + const QString presetName = presetConfigItem.expandedValue(k); + const bool haveSameKitConfigHash = kitConfigHashItem.isNull() + ? true + : data->cmakePresetDefaultConfigHash + == kitConfigHashItem.value; + + if (data->cmakePreset != presetName || !haveSameKitConfigHash) return false; ensureBuildDirectory(*data, k); @@ -724,15 +735,6 @@ Kit *CMakeProjectImporter::createKit(void *directoryData) const CMakeGeneratorKitAspect::setPlatform(k, data->platform); CMakeGeneratorKitAspect::setToolset(k, data->toolset); - if (!data->cmakePresetDisplayname.isEmpty()) { - k->setUnexpandedDisplayName( - QString("%1 (CMake preset)").arg(data->cmakePresetDisplayname)); - - CMakeConfigurationKitAspect::setCMakePreset(k, data->cmakePreset); - } - if (!data->cmakePreset.isEmpty()) - ensureBuildDirectory(*data, k); - SysRootKitAspect::setSysRoot(k, data->sysroot); for (const ToolChainDescription &cmtcd : data->toolChains) { @@ -747,6 +749,16 @@ Kit *CMakeProjectImporter::createKit(void *directoryData) const ToolChainKitAspect::setToolChain(k, tcd.tcs.at(0)); } + if (!data->cmakePresetDisplayname.isEmpty()) { + k->setUnexpandedDisplayName( + QString("%1 (CMake preset)").arg(data->cmakePresetDisplayname)); + + CMakeConfigurationKitAspect::setCMakePreset(k, data->cmakePreset); + CMakeConfigurationKitAspect::setKitDefaultConfigHash(k); + } + if (!data->cmakePreset.isEmpty()) + ensureBuildDirectory(*data, k); + qCInfo(cmInputLog) << "Temporary Kit created."; }); } From 6e7c257a8cfec316fc863119716f4ea7dd66e831 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 10 Jan 2023 09:35:17 +0100 Subject: [PATCH 5/7] AutoTest: Fix checked state for QtTest Data functions and special functions may get handled as normal test functions which obviously fails when executing tests. Change-Id: I630fedcdbcc7577c1896f8cccbe77008a623900f Reviewed-by: David Schulz --- src/plugins/autotest/qtest/qttesttreeitem.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/autotest/qtest/qttesttreeitem.cpp b/src/plugins/autotest/qtest/qttesttreeitem.cpp index 08ab4f52fc7..222680d4cf1 100644 --- a/src/plugins/autotest/qtest/qttesttreeitem.cpp +++ b/src/plugins/autotest/qtest/qttesttreeitem.cpp @@ -85,6 +85,13 @@ Qt::ItemFlags QtTestTreeItem::flags(int column) const Qt::CheckState QtTestTreeItem::checked() const { + switch (type()) { + case TestDataFunction: + case TestSpecialFunction: + return Qt::Unchecked; + default: + break; + } return m_multiTest ? Qt::Unchecked : TestTreeItem::checked(); } From 7684571e108f5d7a803944a1cd78f17b61a29c35 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 10 Jan 2023 09:36:43 +0100 Subject: [PATCH 6/7] AutoTest: Fix handling of data tags with spaces Change-Id: Ie725d8bf67b6a143f52c84b902b69a077a55a2bc Reviewed-by: David Schulz --- src/plugins/autotest/qtest/qttesttreeitem.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/autotest/qtest/qttesttreeitem.cpp b/src/plugins/autotest/qtest/qttesttreeitem.cpp index 222680d4cf1..dcada43181f 100644 --- a/src/plugins/autotest/qtest/qttesttreeitem.cpp +++ b/src/plugins/autotest/qtest/qttesttreeitem.cpp @@ -15,6 +15,13 @@ namespace Autotest { namespace Internal { +static QString functionWithDataTagAsArg(const QString &func, const QString &dataTag) +{ + if (dataTag.contains(' ')) + return '"' + func + ':' + dataTag + '"'; + return func + ':' + dataTag; +} + QtTestTreeItem::QtTestTreeItem(ITestFramework *testFramework, const QString &name, const Utils::FilePath &filePath, TestTreeItem::Type type) : TestTreeItem(testFramework, name, filePath, type) @@ -140,9 +147,8 @@ ITestConfiguration *QtTestTreeItem::testConfiguration() const const TestTreeItem *parent = function ? function->parentItem() : nullptr; if (!parent) return nullptr; - const QString functionWithTag = function->name() + ':' + name(); config = new QtTestConfiguration(framework()); - config->setTestCases(QStringList(functionWithTag)); + config->setTestCases(QStringList(functionWithDataTagAsArg(function->name(), name()))); config->setProjectFile(parent->proFile()); config->setProject(project); break; @@ -185,7 +191,7 @@ static void fillTestConfigurationsFromCheckState(const TestTreeItem *item, const QString funcName = grandChild->name(); grandChild->forFirstLevelChildren([&testCases, &funcName](ITestTreeItem *dataTag) { if (dataTag->checked() == Qt::Checked) - testCases << funcName + ':' + dataTag->name(); + testCases << functionWithDataTagAsArg(funcName, dataTag->name()); }); } }); @@ -217,7 +223,7 @@ static void collectFailedTestInfo(TestTreeItem *item, QListforFirstLevelChildren([&testCases, func](ITestTreeItem *dataTag) { if (dataTag->data(0, FailedRole).toBool()) - testCases << func->name() + ':' + dataTag->name(); + testCases << functionWithDataTagAsArg(func->name(), dataTag->name()); }); } }); From c2788b0f053015f08aa979c93ab920303a28ebd6 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Tue, 10 Jan 2023 12:44:33 +0100 Subject: [PATCH 7/7] Debugger: Add missing space Change-Id: Ibb8623392c1b0e759df198fab87a6059558236e9 Reviewed-by: David Schulz --- src/plugins/debugger/debuggeractions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 0dec35b3fd4..eb1ebb2ee3c 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -159,7 +159,7 @@ DebuggerSettings::DebuggerSettings() cdbBreakPointCorrection.setSettingsKey(cdbSettingsGroup, "BreakpointCorrection"); cdbBreakPointCorrection.setDefaultValue(true); cdbBreakPointCorrection.setToolTip("

" + Tr::tr( - "Attempts to correct the location of a breakpoint based on file and line number should" + "Attempts to correct the location of a breakpoint based on file and line number should " "it be in a comment or in a line for which no code is generated. " "The correction is based on the code model.") + "

"); cdbBreakPointCorrection.setLabelText(Tr::tr("Correct breakpoint location"));