From 392bda1160d3578861b74d87167e70f10287b323 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Fri, 28 May 2021 12:02:18 +0200 Subject: [PATCH 01/12] CMakePM: Save cmake parameters in qtcsettings.cmake also for initial run This way projects can have access to all CMake parameters that were issued from Qt Creator. Previously the initial run was skipped, only the subsequent changes were picked up. Change-Id: I7a2262cdb9754ff666f78fd2e39663466f494f5f Reviewed-by: Alessandro Portale --- .../cmakeprojectmanager/cmakebuildsystem.cpp | 23 ------------------- .../cmakeprojectmanager/cmakebuildsystem.h | 2 -- .../cmakeprojectmanager/cmakeconfigitem.cpp | 2 +- .../cmakeprojectmanager/fileapireader.cpp | 23 +++++++++++++++++++ .../cmakeprojectmanager/fileapireader.h | 2 ++ 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 0fe4bfe3b31..560b9251ae2 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -380,27 +380,6 @@ QString CMakeBuildSystem::reparseParametersString(int reparseFlags) return result.trimmed(); } -void CMakeBuildSystem::writeConfigurationIntoBuildDirectory() -{ - const Utils::MacroExpander *expander = cmakeBuildConfiguration()->macroExpander(); - const FilePath buildDir = workDirectory(m_parameters); - QTC_ASSERT(buildDir.exists(), return ); - - const FilePath settingsFile = buildDir.pathAppended("qtcsettings.cmake"); - - QByteArray contents; - contents.append("# This file is managed by Qt Creator, do not edit!\n\n"); - contents.append( - transform(cmakeBuildConfiguration()->configurationChanges(), - [expander](const CMakeConfigItem &item) { return item.toCMakeSetLine(expander); }) - .join('\n') - .toUtf8()); - - QFile file(settingsFile.toString()); - QTC_ASSERT(file.open(QFile::WriteOnly | QFile::Truncate), return ); - file.write(contents); -} - void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters ¶meters, const int reparseParameters) { @@ -434,8 +413,6 @@ void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters &pa m_reader.setParameters(m_parameters); - writeConfigurationIntoBuildDirectory(); - if (reparseParameters & REPARSE_URGENT) { qCDebug(cmakeBuildSystemLog) << "calling requestReparse"; requestParse(); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.h b/src/plugins/cmakeprojectmanager/cmakebuildsystem.h index 3b591c15815..07cffaa4f9f 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.h @@ -158,8 +158,6 @@ private: void runCTest(); - void writeConfigurationIntoBuildDirectory(); - ProjectExplorer::TreeScanner m_treeScanner; QHash m_mimeBinaryCache; QList m_allFiles; diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigitem.cpp b/src/plugins/cmakeprojectmanager/cmakeconfigitem.cpp index 4887bd130dd..7e30f661fb2 100644 --- a/src/plugins/cmakeprojectmanager/cmakeconfigitem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeconfigitem.cpp @@ -200,7 +200,7 @@ QString CMakeConfigItem::expandedValue(const ProjectExplorer::Kit *k) const QString CMakeConfigItem::expandedValue(const Utils::MacroExpander *expander) const { - return expander->expand(QString::fromUtf8(value)); + return expander ? expander->expand(QString::fromUtf8(value)) : QString::fromUtf8(value); } std::function CMakeConfigItem::sortOperator() diff --git a/src/plugins/cmakeprojectmanager/fileapireader.cpp b/src/plugins/cmakeprojectmanager/fileapireader.cpp index 2b3a086b1ec..303503eccc2 100644 --- a/src/plugins/cmakeprojectmanager/fileapireader.cpp +++ b/src/plugins/cmakeprojectmanager/fileapireader.cpp @@ -336,6 +336,28 @@ void FileApiReader::makeBackupConfiguration(bool store) } +void FileApiReader::writeConfigurationIntoBuildDirectory(const QStringList &configurationArguments) +{ + const FilePath buildDir = m_parameters.workDirectory; + QTC_ASSERT(buildDir.exists(), return ); + + const FilePath settingsFile = buildDir.pathAppended("qtcsettings.cmake"); + + QByteArray contents; + contents.append("# This file is managed by Qt Creator, do not edit!\n\n"); + contents.append( + transform(CMakeConfigItem::itemsFromArguments(configurationArguments), + [](const CMakeConfigItem &item) { + return item.toCMakeSetLine(nullptr); + }) + .join('\n') + .toUtf8()); + + QFile file(settingsFile.toString()); + QTC_ASSERT(file.open(QFile::WriteOnly | QFile::Truncate), return ); + file.write(contents); +} + void FileApiReader::startCMakeState(const QStringList &configurationArguments) { qCDebug(cmakeFileApiMode) << "FileApiReader: START CMAKE STATE."; @@ -347,6 +369,7 @@ void FileApiReader::startCMakeState(const QStringList &configurationArguments) qCDebug(cmakeFileApiMode) << ">>>>>> Running cmake with arguments:" << configurationArguments; makeBackupConfiguration(true); + writeConfigurationIntoBuildDirectory(configurationArguments); m_cmakeProcess->run(m_parameters, configurationArguments); } diff --git a/src/plugins/cmakeprojectmanager/fileapireader.h b/src/plugins/cmakeprojectmanager/fileapireader.h index 505f5fd5065..1a7d7dc3d38 100644 --- a/src/plugins/cmakeprojectmanager/fileapireader.h +++ b/src/plugins/cmakeprojectmanager/fileapireader.h @@ -93,6 +93,8 @@ private: void replyDirectoryHasChanged(const QString &directory) const; void makeBackupConfiguration(bool store); + void writeConfigurationIntoBuildDirectory(const QStringList &configuration); + std::unique_ptr m_cmakeProcess; // cmake data: From 58d03f3f2f977b81b4c9224a3cfdca7802d89ff0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 31 May 2021 15:09:28 +0200 Subject: [PATCH 02/12] CMake: cancel file api parsing Change-Id: Ie59370fa4329f92dd28bf3e147b2828cbd75330b Reviewed-by: Qt CI Bot Reviewed-by: Eike Ziller --- .../cmakeprojectmanager/fileapiparser.cpp | 24 ++++++++++++++++--- .../cmakeprojectmanager/fileapiparser.h | 7 +++++- .../cmakeprojectmanager/fileapireader.cpp | 11 +++++---- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/fileapiparser.cpp b/src/plugins/cmakeprojectmanager/fileapiparser.cpp index 909636c2dfc..78a3a599410 100644 --- a/src/plugins/cmakeprojectmanager/fileapiparser.cpp +++ b/src/plugins/cmakeprojectmanager/fileapiparser.cpp @@ -870,7 +870,9 @@ static QStringList uniqueTargetFiles(const Configuration &config) return files; } -FileApiData FileApiParser::parseData(const QFileInfo &replyFileInfo, const QString &cmakeBuildType, +FileApiData FileApiParser::parseData(QFutureInterface> &fi, + const QFileInfo &replyFileInfo, + const QString &cmakeBuildType, QString &errorMessage) { QTC_CHECK(errorMessage.isEmpty()); @@ -878,16 +880,29 @@ FileApiData FileApiParser::parseData(const QFileInfo &replyFileInfo, const QStri FileApiData result; + const auto cancelCheck = [&fi, &errorMessage]() -> bool { + if (fi.isCanceled()) { + errorMessage = FileApiParser::tr("CMake parsing was cancelled."); + return true; + } + return false; + }; + result.replyFile = readReplyFile(replyFileInfo, errorMessage); + if (cancelCheck()) + return {}; result.cache = readCacheFile(result.replyFile.jsonFile("cache", replyDir), errorMessage); + if (cancelCheck()) + return {}; result.cmakeFiles = readCMakeFilesFile(result.replyFile.jsonFile("cmakeFiles", replyDir), errorMessage); + if (cancelCheck()) + return {}; auto codeModels = readCodemodelFile(result.replyFile.jsonFile("codemodel", replyDir), errorMessage); if (codeModels.size() == 0) { errorMessage = "No CMake configuration found!"; - qWarning() << errorMessage; return result; } @@ -911,14 +926,17 @@ FileApiData FileApiParser::parseData(const QFileInfo &replyFileInfo, const QStri .arg(cmakeBuildType) .arg(buildTypes.join(", ")); } - qWarning() << errorMessage; return result; } result.codemodel = std::move(*it); + if (cancelCheck()) + return {}; const QStringList targetFiles = uniqueTargetFiles(result.codemodel); for (const QString &targetFile : targetFiles) { + if (cancelCheck()) + return {}; QString targetErrorMessage; TargetDetails td = readTargetFile(replyDir.absoluteFilePath(targetFile), targetErrorMessage); if (targetErrorMessage.isEmpty()) { diff --git a/src/plugins/cmakeprojectmanager/fileapiparser.h b/src/plugins/cmakeprojectmanager/fileapiparser.h index 6650d5e75ae..850a3de859f 100644 --- a/src/plugins/cmakeprojectmanager/fileapiparser.h +++ b/src/plugins/cmakeprojectmanager/fileapiparser.h @@ -27,6 +27,8 @@ #include "cmakeconfigitem.h" +#include "fileapidataextractor.h" + #include #include @@ -34,6 +36,7 @@ #include #include +#include #include #include @@ -247,7 +250,9 @@ class FileApiParser { Q_DECLARE_TR_FUNCTIONS(FileApiParser) public: - static FileApiData parseData(const QFileInfo &replyFileInfo, const QString& cmakeBuildType, + static FileApiData parseData(QFutureInterface> &fi, + const QFileInfo &replyFileInfo, + const QString &cmakeBuildType, QString &errorMessage); static bool setupCMakeFileApi(const Utils::FilePath &buildDirectory, diff --git a/src/plugins/cmakeprojectmanager/fileapireader.cpp b/src/plugins/cmakeprojectmanager/fileapireader.cpp index 303503eccc2..1171b9d5480 100644 --- a/src/plugins/cmakeprojectmanager/fileapireader.cpp +++ b/src/plugins/cmakeprojectmanager/fileapireader.cpp @@ -265,11 +265,14 @@ void FileApiReader::endState(const QFileInfo &replyFi) m_lastReplyTimestamp = replyFi.lastModified(); m_future = runAsync(ProjectExplorerPlugin::sharedThreadPool(), - [replyFi, sourceDirectory, buildDirectory, topCmakeFile, cmakeBuildType]() { + [replyFi, sourceDirectory, buildDirectory, topCmakeFile, cmakeBuildType]( + QFutureInterface> &fi) { auto result = std::make_shared(); - FileApiData data = FileApiParser::parseData(replyFi, cmakeBuildType, result->errorMessage); + FileApiData data = FileApiParser::parseData(fi, + replyFi, + cmakeBuildType, + result->errorMessage); if (!result->errorMessage.isEmpty()) { - qWarning() << result->errorMessage; *result = generateFallbackData(topCmakeFile, sourceDirectory, buildDirectory, @@ -281,7 +284,7 @@ void FileApiReader::endState(const QFileInfo &replyFi) qWarning() << result->errorMessage; } - return result; + fi.reportResult(result); }); onResultReady(m_future.value(), this, From b9c9c37a515f9dd79fa4e9e6c8c0168d76e6d5e3 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 2 Jun 2021 16:24:33 +0200 Subject: [PATCH 03/12] CppTools: Add missing null pointer check Prevents a crash trying to look for decl/def matches in non-applicable locations. Fixes: QTCREATORBUG-25806 Change-Id: I70961109267a2955bef0434a92f1d913b8c0c9c1 Reviewed-by: Christian Stenger --- src/plugins/cpptools/symbolfinder.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/cpptools/symbolfinder.cpp b/src/plugins/cpptools/symbolfinder.cpp index 0c0c1f3d15a..7147f1d1c41 100644 --- a/src/plugins/cpptools/symbolfinder.cpp +++ b/src/plugins/cpptools/symbolfinder.cpp @@ -436,6 +436,9 @@ QList SymbolFinder::findMatchingDeclaration(const LookupContext & Function *functionType) { QList result; + if (!functionType) + return result; + QList nameMatch, argumentCountMatch, typeMatch; findMatchingDeclaration(context, functionType, &typeMatch, &argumentCountMatch, &nameMatch); result.append(typeMatch); From 2ef2e497fc7a0f91db91d6d6a3a2cc3db03363ad Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 1 Jun 2021 16:58:19 +0200 Subject: [PATCH 04/12] CMakePM: Cancel active C/C++ parsing before starting CMake If CMake is being triggered when C/C++ parsing is running, make sure to cancel() the C/C++ parsing before running CMake. The C/C++ parsing is issued after the CMake project is loaded, so for a subsequent CMake run there is no need to have the system busy with C/C++ parsing and at the same time run CMake. Change-Id: Ib9a2e057a90d9572e904ff449666bb9b12d1accc Reviewed-by: David Schulz Reviewed-by: Eike Ziller --- src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index 560b9251ae2..94eeb5032e1 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -296,6 +296,10 @@ void CMakeBuildSystem::triggerParsing() reparseParameters |= REPARSE_FORCE_CMAKE_RUN | REPARSE_FORCE_EXTRA_CONFIGURATION; } + // The code model will be updated after the CMake run. There is no need to have an + // active code model updater when the next one will be triggered. + m_cppCodeModelUpdater->cancel(); + qCDebug(cmakeBuildSystemLog) << "Asking reader to parse"; m_reader.parse(reparseParameters & REPARSE_FORCE_CMAKE_RUN, reparseParameters & REPARSE_FORCE_INITIAL_CONFIGURATION, From f9e4370c4d9b5ef7a68e80279448c4d634782b5a Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Thu, 3 Jun 2021 16:30:26 +0200 Subject: [PATCH 05/12] Update Qbs submodule to the top of 1.19 branch Change-Id: I8d404b0c45822afe8a95bdc777af0685906bbf6d Reviewed-by: Christian Kandeler --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 86eb6974126..f002b866e7e 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 86eb6974126b4fdf4cfa3340b7a80833479f2d37 +Subproject commit f002b866e7e190ddcadfb61ca935c6f0b6ef7e1a From 27a8cb376ea2e54f807567285455714cad5891f5 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 4 May 2021 16:08:36 +0200 Subject: [PATCH 06/12] StudioWelcome: Pseudo destaturation Qt 6 does not have the QtGraphicalEffects module anymore. Change-Id: Idb4e9d141a65b31ad68058d95ffa519bd65f5c4c Reviewed-by: Miikka Heikkinen Reviewed-by: Thomas Hartmann --- .../qml/welcomepage/SaturationEffect.qml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/studiowelcome/qml/welcomepage/SaturationEffect.qml b/src/plugins/studiowelcome/qml/welcomepage/SaturationEffect.qml index 4f85e681a46..32d2448d6ee 100644 --- a/src/plugins/studiowelcome/qml/welcomepage/SaturationEffect.qml +++ b/src/plugins/studiowelcome/qml/welcomepage/SaturationEffect.qml @@ -24,14 +24,18 @@ ****************************************************************************/ import QtQuick 2.0 -import QtGraphicalEffects 1.0 Item { id: root property real desaturation: 1.0 - layer.enabled: true - layer.effect: Desaturate { - desaturation: root.desaturation + + Rectangle { + z: 10 + anchors.fill: parent + color: "#2d2e30" + anchors.margins: -16 + + opacity: root.desaturation * 0.6 } } From b7218a34dda3ee29064b591d3cc2d29b3dbc1907 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 10 May 2021 11:35:46 +0200 Subject: [PATCH 07/12] Add support for the Cypress traveo II kit Fixes: UL-4242 Change-Id: I0b492a3edd6a1dce9d214e6490e174050c3fdb30 Reviewed-by: Reviewed-by: Alessandro Portale (cherry picked from commit d98feae8f6fb2f019571f678e8cd55d8a7b5af6d) --- src/plugins/mcusupport/mcusupportoptions.cpp | 13 +++-- src/plugins/mcusupport/mcusupportoptions.h | 1 + src/plugins/mcusupport/mcusupportsdk.cpp | 53 ++++++++++++++++++++ 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 56bcf57165a..5f9c512bb2d 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -412,11 +412,14 @@ ToolChain *McuToolChainPackage::toolChain(Id language) const QString McuToolChainPackage::toolChainName() const { - return QLatin1String(m_type == TypeArmGcc - ? "armgcc" : m_type == McuToolChainPackage::TypeIAR - ? "iar" : m_type == McuToolChainPackage::TypeKEIL - ? "keil" : m_type == McuToolChainPackage::TypeGHS - ? "ghs" : "unsupported"); + switch (m_type) { + case TypeArmGcc: return QLatin1String("armgcc"); + case TypeIAR: return QLatin1String("iar"); + case TypeKEIL: return QLatin1String("keil"); + case TypeGHS: return QLatin1String("ghs"); + case TypeGHSArm: return QLatin1String("ghs-arm"); + default: return QLatin1String("unsupported"); + } } QString McuToolChainPackage::cmakeToolChainFileName() const diff --git a/src/plugins/mcusupport/mcusupportoptions.h b/src/plugins/mcusupport/mcusupportoptions.h index 57772bafb22..515d22945dd 100644 --- a/src/plugins/mcusupport/mcusupportoptions.h +++ b/src/plugins/mcusupport/mcusupportoptions.h @@ -126,6 +126,7 @@ public: TypeGHS, TypeMSVC, TypeGCC, + TypeGHSArm, TypeUnsupported }; diff --git a/src/plugins/mcusupport/mcusupportsdk.cpp b/src/plugins/mcusupport/mcusupportsdk.cpp index e5bb7f911b5..635f5903f8c 100644 --- a/src/plugins/mcusupport/mcusupportsdk.cpp +++ b/src/plugins/mcusupport/mcusupportsdk.cpp @@ -134,6 +134,23 @@ static McuToolChainPackage *createGhsToolchainPackage() return result; } +static McuToolChainPackage *createGhsArmToolchainPackage() +{ + const char envVar[] = "GHS_ARM_COMPILER_DIR"; + + const QString defaultPath = + qEnvironmentVariableIsSet(envVar) ? qEnvironmentVariable(envVar) : QDir::homePath(); + + auto result = new McuToolChainPackage( + "Green Hills Compiler for ARM", + defaultPath, + Utils::HostOsInfo::withExecutableSuffix("cxarm"), + "GHSArmToolchain", + McuToolChainPackage::TypeGHSArm); + result->setEnvironmentVariableName(envVar); + return result; +} + static McuToolChainPackage *createIarToolChainPackage() { const char envVar[] = "IAR_ARM_COMPILER_DIR"; @@ -248,6 +265,35 @@ static McuPackage *createMcuXpressoIdePackage() return result; } +static McuPackage *createCypressProgrammerPackage() +{ + const char envVar[] = "CYPRESS_AUTO_FLASH_UTILITY_DIR"; + + QString defaultPath; + if (qEnvironmentVariableIsSet(envVar)) { + defaultPath = qEnvironmentVariable(envVar); + } else if (Utils::HostOsInfo::isWindowsHost()) { + auto candidate = findInProgramFiles(QLatin1String("/Cypress/Cypress Auto Flash Utility 1.0/")); + if (QFileInfo::exists(candidate)) { + defaultPath = candidate; + } + } else { + defaultPath = QLatin1String("/usr"); + } + + if (defaultPath.isEmpty()) { + defaultPath = QDir::homePath(); + } + + auto result = new McuPackage( + "Cypress Auto Flash Utility", + defaultPath, + Utils::HostOsInfo::withExecutableSuffix("/bin/openocd"), + "CypressAutoFlashUtil"); + result->setEnvironmentVariableName(envVar); + return result; +} + struct McuTargetDescription { enum class TargetType { @@ -269,6 +315,9 @@ struct McuTargetDescription TargetType type; }; +/// Create the McuPackage by checking the "boardSdk" property in the JSON file for the board. +/// The name of the environment variable pointing to the the SDK for the board will be defined in the "envVar" property +/// inside the "boardSdk". static McuPackage *createBoardSdkPackage(const McuTargetDescription& desc) { const auto generateSdkName = [](const QString& envVar) { @@ -495,11 +544,15 @@ static QVector targetsFromDescriptions(const QList vendorPkgs = { {{"ST"}, createStm32CubeProgrammerPackage()}, {{"NXP"}, createMcuXpressoIdePackage()}, + {{"CYPRESS"}, createCypressProgrammerPackage()}, }; McuTargetFactory targetFactory(tcPkgs, vendorPkgs); From b41bf33dff21f1e534645e346444cb995c766a6a Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 10 May 2021 14:20:26 +0200 Subject: [PATCH 08/12] Change the generator for the GHS and GHS-Arm compiler to Jom Using Ninja not all modified files will be compiled in an incremental build. Fixes: UL-4247 Change-Id: I0bdb1e611e54ea6674ccae4d23391ac86f0960b8 Reviewed-by: Reviewed-by: Alessandro Portale (cherry picked from commit 3ed6f5805688a3e39a898d6aad6f9cd2159a2f42) --- src/plugins/mcusupport/mcusupportoptions.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 5f9c512bb2d..2742a108f18 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -757,6 +757,15 @@ static void setKitCMakeOptions(Kit *k, const McuTarget* mcuTarget, const QString if (kitNeedsQtVersion()) config.append(CMakeConfigItem("CMAKE_PREFIX_PATH", "%{Qt:QT_INSTALL_PREFIX}")); CMakeConfigurationKitAspect::setConfiguration(k, config); + + if (HostOsInfo::isWindowsHost()) { + auto type = mcuTarget->toolChainPackage()->type(); + if (type == McuToolChainPackage::TypeGHS || type == McuToolChainPackage::TypeGHSArm) { + // See https://bugreports.qt.io/browse/UL-4247?focusedCommentId=565802&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-565802 + // and https://bugreports.qt.io/browse/UL-4247?focusedCommentId=565803&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-565803 + CMakeGeneratorKitAspect::setGenerator(k, "NMake Makefiles JOM"); + } + } } static void setKitQtVersionOptions(Kit *k) From 3282aa92f891b4eab1075eccdfe0df6eb4f7f1c1 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 27 May 2021 10:48:22 +0200 Subject: [PATCH 09/12] Fix missing checks for GHS-Arm Some places where ghs-specific checks were done, were not modified to do the same for ghs-arm. Change-Id: I484f98209188e4c160a13248ca3c3f046b342b22 Reviewed-by: Reviewed-by: Alessandro Portale (cherry picked from commit 943c31a5b4d5229a6727089f38497ad43cbfffbf) --- src/plugins/mcusupport/mcusupportoptions.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/mcusupport/mcusupportoptions.cpp b/src/plugins/mcusupport/mcusupportoptions.cpp index 2742a108f18..67d0bac89d8 100644 --- a/src/plugins/mcusupport/mcusupportoptions.cpp +++ b/src/plugins/mcusupport/mcusupportoptions.cpp @@ -643,7 +643,8 @@ static void setKitToolchains(Kit *k, const McuToolChainPackage *tcPackage) { // No Green Hills toolchain, because support for it is missing. if (tcPackage->type() == McuToolChainPackage::TypeUnsupported - || tcPackage->type() == McuToolChainPackage::TypeGHS) + || tcPackage->type() == McuToolChainPackage::TypeGHS + || tcPackage->type() == McuToolChainPackage::TypeGHSArm) return; ToolChainKitAspect::setToolChain(k, tcPackage->toolChain( @@ -660,6 +661,7 @@ static void setKitDebugger(Kit *k, const McuToolChainPackage *tcPackage) // No Green Hills and IAR debugger, because support for it is missing. || tcPackage->type() == McuToolChainPackage::TypeUnsupported || tcPackage->type() == McuToolChainPackage::TypeGHS + || tcPackage->type() == McuToolChainPackage::TypeGHSArm || tcPackage->type() == McuToolChainPackage::TypeIAR) return; @@ -719,7 +721,8 @@ static void setKitCMakeOptions(Kit *k, const McuTarget* mcuTarget, const QString CMakeConfig config = CMakeConfigurationKitAspect::configuration(k); // CMake ToolChain file for ghs handles CMAKE_*_COMPILER autonomously - if (mcuTarget->toolChainPackage()->type() != McuToolChainPackage::TypeGHS) { + if (mcuTarget->toolChainPackage()->type() != McuToolChainPackage::TypeGHS && + mcuTarget->toolChainPackage()->type() != McuToolChainPackage::TypeGHSArm) { config.append(CMakeConfigItem("CMAKE_CXX_COMPILER", "%{Compiler:Executable:Cxx}")); config.append(CMakeConfigItem("CMAKE_C_COMPILER", "%{Compiler:Executable:C}")); } From 637837edf1b93654e15b74521327f6b1d507f940 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 4 Jun 2021 10:50:51 +0200 Subject: [PATCH 10/12] Mode bar: Fix splitting configuration name into two lines Amends 0795d5f42d6ead3ce2bce1203bb527413c6373f4 - QRegularExpression::match does not support negative offsets, so that part was wrong when porting to QRegularExpression - QString::lastIndexOf with QRegularExpression and negative index is broken in Qt > 5.15.2, which leads to endless recursion Use good ol' loops instead, which also saves the overhead of throwing a regular expression on this. Task-number: QTBUG-94215 Change-Id: Ia9747c32fc775f2a735af97a6b73f9a5021882ab Reviewed-by: Christian Stenger --- src/plugins/coreplugin/fancyactionbar.cpp | 52 ++++++++++++++++------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp index ed4d5ddb278..d0b757a5863 100644 --- a/src/plugins/coreplugin/fancyactionbar.cpp +++ b/src/plugins/coreplugin/fancyactionbar.cpp @@ -86,6 +86,42 @@ bool FancyToolButton::event(QEvent *e) return QToolButton::event(e); } +static int findSplitPos(const QString &text, const QFontMetrics &fontMetrics, qreal availableWidth) +{ + if (text.length() == 0) + return -1; + int splitPos = -1; + int lastWhiteSpace; + int firstWhiteSpace = text.length(); + do { + // search backwards for ranges of whitespaces + // search first whitespace (backwards) + lastWhiteSpace = firstWhiteSpace - 1; // start before last blob (or at end of text) + while (lastWhiteSpace >= 0) { + if (text.at(lastWhiteSpace).isSpace()) + break; + --lastWhiteSpace; + } + // search last whitespace (backwards) + firstWhiteSpace = lastWhiteSpace; + while (firstWhiteSpace > 0) { + if (!text.at(firstWhiteSpace - 1).isSpace()) + break; + --firstWhiteSpace; + } + // if the text after the whitespace range fits into the available width, that's a great + // position for splitting, but look if we can fit more + if (firstWhiteSpace != -1) { + if (fontMetrics.horizontalAdvance(text.mid(lastWhiteSpace + 1)) <= availableWidth) + splitPos = lastWhiteSpace + 1; + else + break; + } + } while (firstWhiteSpace > 0 + && fontMetrics.horizontalAdvance(text.left(firstWhiteSpace)) > availableWidth); + return splitPos; +} + static QVector splitInTwoLines(const QString &text, const QFontMetrics &fontMetrics, qreal availableWidth) @@ -95,21 +131,7 @@ static QVector splitInTwoLines(const QString &text, // to put them in the second line. First line is drawn with ellipsis, // second line gets ellipsis if it couldn't split off full words. QVector splitLines(2); - const QRegularExpression rx(QLatin1String("\\s+")); - int splitPos = -1; - int nextSplitPos = text.length(); - do { - int offset = nextSplitPos - text.length() - 1; - nextSplitPos = text.lastIndexOf(rx, offset); - if (nextSplitPos != -1) { - const QRegularExpressionMatch match = rx.match(text, offset); - int splitCandidate = nextSplitPos + match.capturedLength(); - if (fontMetrics.horizontalAdvance(text.mid(splitCandidate)) <= availableWidth) - splitPos = splitCandidate; - else - break; - } - } while (nextSplitPos > 0 && fontMetrics.horizontalAdvance(text.left(nextSplitPos)) > availableWidth); + const int splitPos = findSplitPos(text, fontMetrics, availableWidth); // check if we could split at white space at all if (splitPos < 0) { splitLines[0] = fontMetrics.elidedText(text, Qt::ElideRight, int(availableWidth)); From 2fa63a2801f4dc9a56daf29e41954b8cdc214afb Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Fri, 4 Jun 2021 13:50:31 +0200 Subject: [PATCH 11/12] Fix QKeySequence construction on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Constructing a QKeySequence with the string "Cmd+Opt+Shift+V" leads to an invalid, non-empty QKeySequence when compiling Design Studio on macOS. This triggers an assertion later in the code path. Using “Ctrl+Alt+Shift+V” instead works as expected. Change-Id: I7cb185d18f9ffbb7454c61f28a93cdd307121882 Reviewed-by: Eike Ziller --- src/plugins/texteditor/texteditoractionhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index ee965e8e9cd..98b66f10008 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -273,7 +273,7 @@ void TextEditorActionHandlerPrivate::createActions() QKeySequence(tr("Ctrl+Shift+V")), G_EDIT_COPYPASTE, editMenu); m_modifyingActions << registerAction(NO_FORMAT_PASTE, [] (TextEditorWidget *w) { w->pasteWithoutFormat(); }, false, tr("Paste Without Formatting"), - QKeySequence(Core::useMacShortcuts ? tr("Cmd+Opt+Shift+V") : QString()), G_EDIT_COPYPASTE, editMenu); + QKeySequence(Core::useMacShortcuts ? tr("Ctrl+Alt+Shift+V") : QString()), G_EDIT_COPYPASTE, editMenu); // register "Edit -> Advanced" Menu Actions Core::ActionContainer *advancedEditMenu = Core::ActionManager::actionContainer(M_EDIT_ADVANCED); From 975c6cb096e1eb5866829385dac02ae59a6e61cb Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 4 Jun 2021 15:13:28 +0200 Subject: [PATCH 12/12] iOS: Don't run event loop while executing xcode-select This fixes debugging Qt Creator with the iOS plugin enabled. For unclear reasons running the event loop while executing the process locks Qt Creator up when debugging. Since running the event loop is a dangerous hack anyhow and in this case we don't have much benefit from it, just don't do it. Change-Id: Ie147d3461823587a987d0920efdfae0839fb5b67 Reviewed-by: Alexandru Croitor Reviewed-by: hjk --- src/plugins/ios/iosprobe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/ios/iosprobe.cpp b/src/plugins/ios/iosprobe.cpp index 66518ad7788..da901559e94 100644 --- a/src/plugins/ios/iosprobe.cpp +++ b/src/plugins/ios/iosprobe.cpp @@ -68,7 +68,7 @@ void XcodeProbe::detectDeveloperPaths() Utils::SynchronousProcess selectedXcode; selectedXcode.setTimeoutS(5); const CommandLine xcodeSelect{"/usr/bin/xcode-select", {"--print-path"}}; - Utils::SynchronousProcessResponse response = selectedXcode.run(xcodeSelect); + Utils::SynchronousProcessResponse response = selectedXcode.runBlocking(xcodeSelect); if (response.result != Utils::SynchronousProcessResponse::Finished) qCWarning(probeLog) << QString::fromLatin1("Could not detect selected Xcode using xcode-select");