From 093ec3d34f42542388b1c86721a6fef8fd091b73 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 15 Apr 2024 11:04:21 +0200 Subject: [PATCH 01/12] ModelEditor: Fix crash when selecting an element Same fix as in commit 22f41fb751cd5b1b136e0c7fa15d8e3163bc912e but in a different method. Fixes: QTCREATORBUG-30413 Change-Id: I69790707005edc26c7d3e943d86db132184298e9 Reviewed-by: Marcus Tillmanns --- src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp b/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp index de8b82de20e..13167f691d8 100644 --- a/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp +++ b/src/libs/modelinglib/qmt/diagram_scene/diagramscenemodel.cpp @@ -353,7 +353,9 @@ void DiagramSceneModel::selectAllElements() void DiagramSceneModel::selectElement(DElement *element) { QGraphicsItem *selectItem = m_elementToItemMap.value(element); - for (QGraphicsItem *item : std::as_const(m_selectedItems)) { + // We have to create a copy since "setSelected" may modify m_selectedItems + const QSet copy = m_selectedItems; + for (QGraphicsItem *item : copy) { if (item != selectItem) item->setSelected(false); } From c431f24816f652363838cc5f8f591c98d13582d4 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 9 Apr 2024 17:00:20 +0200 Subject: [PATCH 02/12] PE: Allow configuration of default build dir via env variable This variable is QTC_DEFAULT_BUILD_DIRECTORY_TEMPLATE and can be set in a .shared file, or in the system. Task-number: QTCREATORBUG-30557 Change-Id: Ife221b7cfe88f9a6015bd5fb61270d335f65cb79 Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/buildconfiguration.cpp | 10 +++++++++- .../projectexplorer/buildpropertiessettings.cpp | 5 ++++- src/plugins/projectexplorer/projectexplorerconstants.h | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index f189cf0a9b9..2c475f2ad7b 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -617,7 +617,15 @@ FilePath BuildConfiguration::buildDirectoryFromTemplate(const FilePath &projectD [buildType] { return buildTypeName(buildType); }); exp.registerSubProvider([kit] { return kit->macroExpander(); }); - FilePath buildDir = FilePath::fromUserInput(buildPropertiesSettings().buildDirectoryTemplate()); + auto project = ProjectManager::projectWithProjectFilePath(mainFilePath); + auto environment = Environment::systemEnvironment(); + // This adds the environment variables from the .shared file + if (project) + environment.modify(project->additionalEnvironment()); + + FilePath buildDir = FilePath::fromUserInput(environment.value_or( + Constants::QTC_DEFAULT_BUILD_DIRECTORY_TEMPLATE, + buildPropertiesSettings().buildDirectoryTemplate())); qCDebug(bcLog) << "build dir template:" << buildDir.toUserOutput(); buildDir = exp.expand(buildDir); qCDebug(bcLog) << "expanded build:" << buildDir.toUserOutput(); diff --git a/src/plugins/projectexplorer/buildpropertiessettings.cpp b/src/plugins/projectexplorer/buildpropertiessettings.cpp index c9cde2624d8..5b60e6c9c13 100644 --- a/src/plugins/projectexplorer/buildpropertiessettings.cpp +++ b/src/plugins/projectexplorer/buildpropertiessettings.cpp @@ -8,6 +8,7 @@ #include +#include #include using namespace Utils; @@ -16,7 +17,9 @@ namespace ProjectExplorer { static QString defaultBuildDirectoryTemplate() { - return "./build/%{Asciify:%{Kit:FileSystemName}-%{BuildConfig:Name}}"; + return qtcEnvironmentVariable( + Constants::QTC_DEFAULT_BUILD_DIRECTORY_TEMPLATE, + "./build/%{Asciify:%{Kit:FileSystemName}-%{BuildConfig:Name}}"); } BuildPropertiesSettings &buildPropertiesSettings() diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index 80ffefcc51f..ca0fe5c9e09 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -145,6 +145,8 @@ const char CUSTOM_TOOLCHAIN_TYPEID[] = "ProjectExplorer.ToolChain.Custom"; const char DEFAULT_WORKING_DIR[] = "%{buildDir}"; const char DEFAULT_WORKING_DIR_ALTERNATE[] = "%{sourceDir}"; +const char QTC_DEFAULT_BUILD_DIRECTORY_TEMPLATE[] = "QTC_DEFAULT_BUILD_DIRECTORY_TEMPLATE"; + // Desktop Device related ids: const char DESKTOP_DEVICE_ID[] = "Desktop Device"; const char DESKTOP_DEVICE_TYPE[] = "Desktop"; From 4a95a2d63d75c01b3391a741bc790bc6774debb2 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 11 Apr 2024 15:17:45 +0200 Subject: [PATCH 03/12] Revert CMakePM: Treat all sourceGroups as sourcesOrHeaders project nodes This reverts commit 973e9dcf9014a382d2b2ac89205edc08a6d5e18d. Fixes: QTCREATORBUG-30602 Change-Id: I9db6dc6d3fbd7d9a5e48a25bca725a4f86124318 Reviewed-by: Marcus Tillmanns --- .../cmakeprojectmanager/fileapidataextractor.cpp | 2 +- src/plugins/cmakeprojectmanager/projecttreehelper.cpp | 10 ++++------ src/plugins/cmakeprojectmanager/projecttreehelper.h | 4 +--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index a4e94e334a2..e9f6d4351d4 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -633,7 +633,7 @@ static FolderNode *createSourceGroupNode(const QString &sourceGroupName, FolderNode *existingNode = currentNode->findChildFolderNode( [&p](const FolderNode *fn) { return fn->displayName() == p; }); if (!existingNode) { - auto node = createCMakeVFolder(sourceDirectory, Node::DefaultFolderPriority + 5, p, true); + auto node = createCMakeVFolder(sourceDirectory, Node::DefaultFolderPriority + 5, p); node->setListInProject(false); node->setIcon([] { return Icon::fromTheme("edit-copy"); }); diff --git a/src/plugins/cmakeprojectmanager/projecttreehelper.cpp b/src/plugins/cmakeprojectmanager/projecttreehelper.cpp index e17505095a6..7987fdb0c56 100644 --- a/src/plugins/cmakeprojectmanager/projecttreehelper.cpp +++ b/src/plugins/cmakeprojectmanager/projecttreehelper.cpp @@ -20,13 +20,13 @@ namespace CMakeProjectManager::Internal { std::unique_ptr createCMakeVFolder(const Utils::FilePath &basePath, int priority, - const QString &displayName, - bool sourcesOrHeaders) + const QString &displayName) { auto newFolder = std::make_unique(basePath); newFolder->setPriority(priority); newFolder->setDisplayName(displayName); - newFolder->setIsSourcesOrHeaders(sourcesOrHeaders); + newFolder->setIsSourcesOrHeaders(displayName == "Source Files" + || displayName == "Header Files"); return newFolder; } @@ -35,14 +35,13 @@ void addCMakeVFolder(FolderNode *base, int priority, const QString &displayName, std::vector> &&files, - bool sourcesOrHeaders, bool listInProject) { if (files.size() == 0) return; FolderNode *folder = base; if (!displayName.isEmpty()) { - auto newFolder = createCMakeVFolder(basePath, priority, displayName, sourcesOrHeaders); + auto newFolder = createCMakeVFolder(basePath, priority, displayName); folder = newFolder.get(); base->addNode(std::move(newFolder)); } @@ -90,7 +89,6 @@ void addCMakeInputs(FolderNode *root, 10, Tr::tr(""), removeKnownNodes(knownFiles, std::move(rootInputs)), - /*sourcesOrHeaders=*/false, /*listInProject=*/false); root->addNode(std::move(cmakeVFolder)); diff --git a/src/plugins/cmakeprojectmanager/projecttreehelper.h b/src/plugins/cmakeprojectmanager/projecttreehelper.h index bcd5500db97..5a7ffaa8b25 100644 --- a/src/plugins/cmakeprojectmanager/projecttreehelper.h +++ b/src/plugins/cmakeprojectmanager/projecttreehelper.h @@ -13,15 +13,13 @@ namespace CMakeProjectManager::Internal { std::unique_ptr createCMakeVFolder(const Utils::FilePath &basePath, int priority, - const QString &displayName, - bool sourcesOrHeaders); + const QString &displayName); void addCMakeVFolder(ProjectExplorer::FolderNode *base, const Utils::FilePath &basePath, int priority, const QString &displayName, std::vector> &&files, - bool sourcesOrHeaders = false, bool listInProject = true); std::vector> &&removeKnownNodes( From f76e0de7bc98a3d7171390d682bb5046ddfce634 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 11 Apr 2024 18:29:36 +0200 Subject: [PATCH 04/12] CMakePM: Do not show subfolders for custom source_groups CMake does have a few default source groups (cmMakefile.cxx): this->AddSourceGroup("", "^.*$"); this->AddSourceGroup("Source Files", CM_SOURCE_REGEX); this->AddSourceGroup("Header Files", CM_HEADER_REGEX); this->AddSourceGroup("Precompile Header File", CM_PCH_REGEX); this->AddSourceGroup("CMake Rules", "\\.rule$"); this->AddSourceGroup("Resources", CM_RESOURCE_REGEX); this->AddSourceGroup("Object Files", "\\.(lo|o|obj)$"); This commit will get Qt Creator to display the actual subfolder structure only if the CMake setting "Show subfolders inside source group folders" is set and for "Source Files" and "Header Files" source groups. Any other source group or a custom source group defined by `source_group` will not get this treatment, since this what the oder IDEs (e.g. Visual Studio) and what the users expect to have. Task-number: QTCREATORBUG-27432 Fixes: QTCREATORBUG-30620 Change-Id: I3c30814df2f76d18ee5fd4fd1356d4dfc4b9b09b Reviewed-by: Marcus Tillmanns Reviewed-by: --- src/plugins/cmakeprojectmanager/fileapidataextractor.cpp | 7 ++++++- src/plugins/cmakeprojectmanager/projecttreehelper.cpp | 8 ++++++-- src/plugins/cmakeprojectmanager/projecttreehelper.h | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index e9f6d4351d4..ea156be8a11 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -654,7 +654,6 @@ static void addCompileGroups(ProjectNode *targetRoot, const FilePath &buildDirectory, const TargetDetails &td) { - const bool showSourceFolders = settings().showSourceSubFolders(); const bool inSourceBuild = (sourceDirectory == buildDirectory); QSet alreadyListed; @@ -685,6 +684,9 @@ static void addCompileGroups(ProjectNode *targetRoot, if (isPchFile(buildDirectory, sourcePath) || isUnityFile(buildDirectory, sourcePath)) node->setIsGenerated(true); + const bool showSourceFolders = settings().showSourceSubFolders() + && sourcesOrHeadersFolder(td.sourceGroups[si.sourceGroup]); + // Where does the file node need to go? if (showSourceFolders && sourcePath.isChildOf(buildDirectory) && !inSourceBuild) { buildFileNodes.emplace_back(std::move(node)); @@ -696,6 +698,9 @@ static void addCompileGroups(ProjectNode *targetRoot, } for (size_t i = 0; i < sourceGroupFileNodes.size(); ++i) { + const bool showSourceFolders = settings().showSourceSubFolders() + && sourcesOrHeadersFolder(td.sourceGroups[i]); + std::vector> ¤t = sourceGroupFileNodes[i]; FolderNode *insertNode = td.sourceGroups[i] == "TREE" ? targetRoot diff --git a/src/plugins/cmakeprojectmanager/projecttreehelper.cpp b/src/plugins/cmakeprojectmanager/projecttreehelper.cpp index 7987fdb0c56..d23f6a4f972 100644 --- a/src/plugins/cmakeprojectmanager/projecttreehelper.cpp +++ b/src/plugins/cmakeprojectmanager/projecttreehelper.cpp @@ -18,6 +18,11 @@ using namespace ProjectExplorer; namespace CMakeProjectManager::Internal { +bool sourcesOrHeadersFolder(const QString &displayName) +{ + return displayName == "Source Files" || displayName == "Header Files"; +} + std::unique_ptr createCMakeVFolder(const Utils::FilePath &basePath, int priority, const QString &displayName) @@ -25,8 +30,7 @@ std::unique_ptr createCMakeVFolder(const Utils::FilePath &basePath, auto newFolder = std::make_unique(basePath); newFolder->setPriority(priority); newFolder->setDisplayName(displayName); - newFolder->setIsSourcesOrHeaders(displayName == "Source Files" - || displayName == "Header Files"); + newFolder->setIsSourcesOrHeaders(sourcesOrHeadersFolder(displayName)); return newFolder; } diff --git a/src/plugins/cmakeprojectmanager/projecttreehelper.h b/src/plugins/cmakeprojectmanager/projecttreehelper.h index 5a7ffaa8b25..258e0a63231 100644 --- a/src/plugins/cmakeprojectmanager/projecttreehelper.h +++ b/src/plugins/cmakeprojectmanager/projecttreehelper.h @@ -11,6 +11,8 @@ namespace CMakeProjectManager::Internal { +bool sourcesOrHeadersFolder(const QString &displayName); + std::unique_ptr createCMakeVFolder(const Utils::FilePath &basePath, int priority, const QString &displayName); From e52743ae813724b0a968733de645d9757c2d30b6 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 15 Apr 2024 17:28:56 +0200 Subject: [PATCH 05/12] ClangCodeModel: Fix context processor Checking for potential include file completion should only consider string literals, not number literals. Fixes: QTCREATORBUG-30607 Change-Id: Ibfb422f1d8be5a5d30489383ecbc359f5ea4a2a9 Reviewed-by: Christian Stenger Reviewed-by: --- .../clangcodemodel/clangactivationsequencecontextprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/clangcodemodel/clangactivationsequencecontextprocessor.cpp b/src/plugins/clangcodemodel/clangactivationsequencecontextprocessor.cpp index 99c40c99b61..71419032249 100644 --- a/src/plugins/clangcodemodel/clangactivationsequencecontextprocessor.cpp +++ b/src/plugins/clangcodemodel/clangactivationsequencecontextprocessor.cpp @@ -132,7 +132,7 @@ void ActivationSequenceContextProcessor::processComment() void ActivationSequenceContextProcessor::processInclude() { - if (m_token.isLiteral() && !isCompletionKindStringLiteralOrSlash()) + if (m_token.isStringLiteral() && !isCompletionKindStringLiteralOrSlash()) m_completionKind = CPlusPlus::T_EOF_SYMBOL; } From fa29657881f6f4d0c7a7660cfdb5544a48baf768 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 10 Apr 2024 16:09:30 +0200 Subject: [PATCH 06/12] CMakePM: Rename source files in set_source_files_properties calls Fixes: QTCREATORBUG-30174 Change-Id: I80b33c1193f4cd579abd295657dc223aad5801ea Reviewed-by: Reviewed-by: Marcus Tillmanns --- .../cmakeprojectmanager/cmakebuildsystem.cpp | 84 +++++++++++-------- 1 file changed, 49 insertions(+), 35 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index f93f41e3e88..e6701ea7507 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -749,14 +749,17 @@ CMakeBuildSystem::projectFileArgumentPosition(const QString &targetName, const Q && func.Arguments().size() > 1 && func.Arguments().front().Value == target_name; }); - for (const auto &func : {function, targetSourcesFunc, addQmlModuleFunc}) { + auto setSourceFilePropFunc = findFunction(*cmakeListFile, [](const auto &func) { + return func.LowerCaseName() == "set_source_files_properties"; + }); + + for (const auto &func : {function, targetSourcesFunc, addQmlModuleFunc, setSourceFilePropFunc}) { if (!func.has_value()) continue; - auto filePathArgument = Utils::findOrDefault(func->Arguments(), - [file_name = fileName.toStdString()]( - const auto &arg) { - return arg.Value == file_name; - }); + auto filePathArgument = Utils::findOrDefault( + func->Arguments(), [file_name = fileName.toStdString()](const auto &arg) { + return arg.Value == file_name; + }); if (!filePathArgument.Value.empty()) { return ProjectFileArgumentPosition{filePathArgument, targetCMakeFile, fileName}; @@ -925,48 +928,59 @@ bool CMakeBuildSystem::renameFile(Node *context, { if (auto n = dynamic_cast(context)) { const FilePath projDir = n->filePath().canonicalPath(); - const QString newRelPathName - = newFilePath.canonicalPath().relativePathFrom(projDir).cleanPath().toString(); + const FilePath newRelPath = newFilePath.canonicalPath().relativePathFrom(projDir).cleanPath(); + const QString newRelPathName = newRelPath.toString(); + + // FilePath needs the file to exist on disk, the old file has already been renamed + const QString oldRelPathName + = newRelPath.parentDir().pathAppended(oldFilePath.fileName()).cleanPath().toString(); const QString targetName = n->buildKey(); const QString key = QStringList{projDir.path(), targetName, oldFilePath.path(), newFilePath.path()}.join( ";"); - auto fileToRename = m_filesToBeRenamed.take(key); - if (!fileToRename.cmakeFile.exists()) { + std::optional fileToRename + = m_filesToBeRenamed.take(key); + if (!fileToRename->cmakeFile.exists()) { qCCritical(cmakeBuildSystemLog).noquote() - << "File" << fileToRename.cmakeFile.path() << "does not exist."; + << "File" << fileToRename->cmakeFile.path() << "does not exist."; return false; } - BaseTextEditor *editor = qobject_cast( - Core::EditorManager::openEditorAt({fileToRename.cmakeFile, - static_cast(fileToRename.argumentPosition.Line), - static_cast(fileToRename.argumentPosition.Column - - 1)}, - Constants::CMAKE_EDITOR_ID, - Core::EditorManager::DoNotMakeVisible)); - if (!editor) { - qCCritical(cmakeBuildSystemLog).noquote() - << "BaseTextEditor cannot be obtained for" << fileToRename.cmakeFile.path() - << fileToRename.argumentPosition.Line << int(fileToRename.argumentPosition.Column); - return false; - } + do { + BaseTextEditor *editor = qobject_cast( + Core::EditorManager::openEditorAt( + {fileToRename->cmakeFile, + static_cast(fileToRename->argumentPosition.Line), + static_cast(fileToRename->argumentPosition.Column - 1)}, + Constants::CMAKE_EDITOR_ID, + Core::EditorManager::DoNotMakeVisible)); + if (!editor) { + qCCritical(cmakeBuildSystemLog).noquote() + << "BaseTextEditor cannot be obtained for" << fileToRename->cmakeFile.path() + << fileToRename->argumentPosition.Line + << int(fileToRename->argumentPosition.Column); + return false; + } - // If quotes were used for the source file, skip the starting quote - if (fileToRename.argumentPosition.Delim == cmListFileArgument::Quoted) - editor->setCursorPosition(editor->position() + 1); + // If quotes were used for the source file, skip the starting quote + if (fileToRename->argumentPosition.Delim == cmListFileArgument::Quoted) + editor->setCursorPosition(editor->position() + 1); - if (!fileToRename.fromGlobbing) - editor->replace(fileToRename.relativeFileName.length(), newRelPathName); + if (!fileToRename->fromGlobbing) + editor->replace(fileToRename->relativeFileName.length(), newRelPathName); - editor->editorWidget()->autoIndent(); - if (!Core::DocumentManager::saveDocument(editor->document())) { - qCCritical(cmakeBuildSystemLog).noquote() - << "Changes to" << fileToRename.cmakeFile.path() << "could not be saved."; - return false; - } + editor->editorWidget()->autoIndent(); + if (!Core::DocumentManager::saveDocument(editor->document())) { + qCCritical(cmakeBuildSystemLog).noquote() + << "Changes to" << fileToRename->cmakeFile.path() << "could not be saved."; + return false; + } + + // Try the next occurrence. This can happen if set_source_file_properties is used + fileToRename = projectFileArgumentPosition(targetName, oldRelPathName); + } while (fileToRename); return true; } From cf7933a9808620cc7c07820a20bcf4d58464becd Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 11 Apr 2024 11:16:16 +0200 Subject: [PATCH 07/12] iOS Simulator: Fix crash when starting app while another is running Qt Creator would crash when starting an app in the Simulator while another app is running, and the old app is not killed by the deployment before run. This could happen in two cases: 1. Running an app in one simulator device and starting that or another app on a different simulator device 2. Running an app in the simulator and starting that or another app on the same device without deployment In the first case, it actually doesn't make sense to stop the running app, the Simulator can run multiple devices simultaneously (this might have been different in the past). In the second case, the new IosRunner initiated a stop of the old RunConfig, and while that was in Stopping state, the app output window tried to re-use the old tab and deleted the old RunConfig. This lead to an assert in the RunConfigPrivate destructor, which only expects to be deleted when in Initialized or Stopped state, and eventually to the crash. The app output window should not reuse tabs that are not "Stopped". Fixes: QTCREATORBUG-30666 Change-Id: If46904dd487301e465e89ce7946be375ab4bdee8 Reviewed-by: Christian Kandeler Reviewed-by: Reviewed-by: Marcus Tillmanns --- src/plugins/ios/iosrunner.cpp | 19 +++++++++++++++---- src/plugins/projectexplorer/appoutputpane.cpp | 16 ++++++++-------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/plugins/ios/iosrunner.cpp b/src/plugins/ios/iosrunner.cpp index 02d47e914fc..b37bd681bcb 100644 --- a/src/plugins/ios/iosrunner.cpp +++ b/src/plugins/ios/iosrunner.cpp @@ -60,18 +60,29 @@ using namespace Tasking; namespace Ios::Internal { +static QString identifierForRunControl(RunControl *runControl) +{ + const IosDeviceTypeAspect::Data *data = runControl->aspect(); + return data ? data->deviceType.identifier : QString(); +} + static void stopRunningRunControl(RunControl *runControl) { static QMap> activeRunControls; + // clean up deleted + Utils::erase(activeRunControls, [](const QPointer &rc) { return !rc; }); + Target *target = runControl->target(); - Id devId = DeviceKitAspect::deviceId(target->kit()); + const Id devId = DeviceKitAspect::deviceId(target->kit()); + const QString identifier = identifierForRunControl(runControl); // The device can only run an application at a time, if an app is running stop it. - if (activeRunControls.contains(devId)) { - if (QPointer activeRunControl = activeRunControls[devId]) + if (QPointer activeRunControl = activeRunControls[devId]) { + if (identifierForRunControl(activeRunControl) == identifier) { activeRunControl->initiateStop(); - activeRunControls.remove(devId); + activeRunControls.remove(devId); + } } if (devId.isValid()) diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 898acaba2a9..806628668f2 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -391,14 +391,14 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) const CommandLine thisCommand = rc->commandLine(); const FilePath thisWorkingDirectory = rc->workingDirectory(); const Environment thisEnvironment = rc->environment(); - const auto tab = std::find_if(m_runControlTabs.begin(), m_runControlTabs.end(), - [&](const RunControlTab &tab) { - if (!tab.runControl || tab.runControl->isRunning() || tab.runControl->isStarting()) - return false; - return thisCommand == tab.runControl->commandLine() - && thisWorkingDirectory == tab.runControl->workingDirectory() - && thisEnvironment == tab.runControl->environment(); - }); + const auto tab = std::find_if( + m_runControlTabs.begin(), m_runControlTabs.end(), [&](const RunControlTab &tab) { + if (!tab.runControl || !tab.runControl->isStopped()) + return false; + return thisCommand == tab.runControl->commandLine() + && thisWorkingDirectory == tab.runControl->workingDirectory() + && thisEnvironment == tab.runControl->environment(); + }); if (tab != m_runControlTabs.end()) { // Reuse this tab if (tab->runControl) From f61ba7c0177b35d906625180e0f793658363bd9f Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 2 Apr 2024 11:35:01 +0200 Subject: [PATCH 08/12] FakeVim: Remove unused function warning when building without WITH_TESTS Change-Id: I33ad1a20046a51c4253056a23d49ac7ddc7a0c54 Reviewed-by: hjk --- src/plugins/fakevim/fakevimplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 07b5ec3b740..7513dde342a 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -999,6 +999,7 @@ bool FakeVimUserCommandsModel::setData(const QModelIndex &index, return true; } +#ifdef WITH_TESTS static void setupTest(QString *title, FakeVimHandler **handler, QWidget **edit) { *title = QString::fromLatin1("test.cpp"); @@ -1040,7 +1041,6 @@ static void setupTest(QString *title, FakeVimHandler **handler, QWidget **edit) (*handler)->handleCommand("set iskeyword=@,48-57,_,192-255,a-z,A-Z"); } -#ifdef WITH_TESTS QObject *createFakeVimTester( void (*setupTest)(QString *, FakeVimHandler **, QWidget **) ); // in fakevim_test.cpp #endif From fcf2d20644902d1a03c1fe36483ef4c141527841 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Mon, 15 Apr 2024 13:05:59 +0200 Subject: [PATCH 09/12] FSEngineImpl: fix the build with Qt 6.7 I, rather naively, cherry-picked the FileTime commit in QAbstractFileEngine in qtbase, fd295f4bf6002b499f1f238efa5a7c8d9c90be39, to the Qt 6.7 branch (commit 22d1a437cb4431a3e7ca1bf8e3b6ba4290d0a0cf), so it will be in effect starting from Qt 6.7.1, which breaks the build if you're using 6.7 HEAD. Thanks to David Faure for pointing this out in the code review. Change-Id: Ia94a75814321c5832099174f9a9c1b47a8cee23d Reviewed-by: Marcus Tillmanns Reviewed-by: hjk --- src/libs/utils/fsengine/fsengine_impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/fsengine/fsengine_impl.h b/src/libs/utils/fsengine/fsengine_impl.h index 00a33f227ce..7a68119c83a 100644 --- a/src/libs/utils/fsengine/fsengine_impl.h +++ b/src/libs/utils/fsengine/fsengine_impl.h @@ -53,7 +53,8 @@ public: uint ownerId(FileOwner) const override; QString owner(FileOwner) const override; -#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) + // The FileTime change in QAbstractFileEngine, in qtbase, is in since Qt 6.7.1 +#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 1) using FileTime = QFile::FileTime; #endif bool setFileTime(const QDateTime &newDate, FileTime time) override; From 6838be76aa1554d45e0aa05a1c780bba5ecdde1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Thu, 4 Apr 2024 23:27:39 +0200 Subject: [PATCH 10/12] SquishTests: Fix wait condition in tst_git_local Change-Id: I401e3c8f8f2743ff9b108d3e25693f834d61e8ac Reviewed-by: Christian Stenger --- tests/system/suite_tools/tst_git_local/test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py index aefdc07d9a1..c74ad6e20cf 100644 --- a/tests/system/suite_tools/tst_git_local/test.py +++ b/tests/system/suite_tools/tst_git_local/test.py @@ -82,7 +82,8 @@ def __clickCommit__(count): test.verify(waitFor('str(fileName.currentText) == expected', 5000), "Verifying editor switches to Git Show.") description = waitForObject(":Qt Creator_DiffEditor::Internal::DescriptionEditorWidget") - waitFor('len(str(description.plainText)) != 0', 5000) + waitFor('len(str(description.plainText)) != 0 ' + 'and str(description.plainText) != "Waiting for data..."', 5000) show = str(description.plainText) id = "Nobody " time = "\w{3} \w{3} \d{1,2} \d{2}:\d{2}:\d{2} \d{4}.* seconds ago\)" From 00ac4b7ccc85c73a1db3927212489b458203fc8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Thu, 11 Apr 2024 16:10:22 +0200 Subject: [PATCH 11/12] SquishTests: Fix supported platforms for Qt Quick 2 Extension Plugin Change-Id: I3accd8f43c5cace3145aacff28ef068ff20ecea2 Reviewed-by: Christian Stenger Reviewed-by: --- tests/system/shared/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index a45d78cfc4b..2ff44dc3737 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -524,7 +524,7 @@ def __getSupportedPlatforms__(text, templateName, getAsStrings=False, ignoreVali version = res.group("version") else: version = None - if templateName == "Qt Quick Application": + if templateName in ("Qt Quick 2 Extension Plugin", "Qt Quick Application"): result = set([Targets.DESKTOP_6_2_4]) elif 'Supported Platforms' in text: supports = text[text.find('Supported Platforms'):].split(":")[1].strip().split("\n") From d4d8ea98b75545f99477d2b6a4c6aaaa1b354891 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 16 Apr 2024 16:38:56 +0200 Subject: [PATCH 12/12] TextEditor: Add Flex/Bison mime types Fixes: QTCREATORBUG-30686 Change-Id: I8f220be4445960573300e76939069788e70ac333 Reviewed-by: Eike Ziller Reviewed-by: hjk Reviewed-by: --- src/plugins/texteditor/TextEditor.json.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/plugins/texteditor/TextEditor.json.in b/src/plugins/texteditor/TextEditor.json.in index 447d9c91c67..f2b6fbbcf58 100644 --- a/src/plugins/texteditor/TextEditor.json.in +++ b/src/plugins/texteditor/TextEditor.json.in @@ -24,6 +24,21 @@ " ", " ", " ", + " ", + " Yacc/Bison source files", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " Lex/Flex source files", + " ", + " ", + " ", + " ", + " ", "" ] }