From 020c2914c31cb4cbf2580df311d3e4e5dc9804d8 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 14 Aug 2019 15:28:03 +0200 Subject: [PATCH] ProjectExplorer: Do not disable run configs because of project parsing After project parsing has ended, the run configurations are set up from the information provided by the parse, and that information is valid until the end of the next parse. There does not appear to be a reason to prevent users from e.g. editing command line arguments or starting the application just because the project is currently being parsed. Task-number: QTCREATORBUG-22548 Change-Id: Ib5e77c747fc2483650bcab22e07881ee7d93500b Reviewed-by: hjk --- .../projectexplorer/runconfiguration.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/plugins/projectexplorer/runconfiguration.cpp b/src/plugins/projectexplorer/runconfiguration.cpp index 457c15cfede..d8b18b77e2a 100644 --- a/src/plugins/projectexplorer/runconfiguration.cpp +++ b/src/plugins/projectexplorer/runconfiguration.cpp @@ -148,7 +148,7 @@ void GlobalOrProjectAspect::resetProjectToGlobalSettings() necessary data as the RunControl may continue to exist after the RunConfiguration has been destroyed. - A RunConfiguration disables itself when the project is parsing or has no parsing + A RunConfiguration disables itself if the project has no parsing data available. The disabledReason() method can be used to get a user-facing string describing why the RunConfiguration considers itself unfit for use. @@ -164,8 +164,6 @@ RunConfiguration::RunConfiguration(Target *target, Core::Id id) : ProjectConfiguration(target, id) { QTC_CHECK(target && target == this->target()); - connect(target->project(), &Project::parsingStarted, - this, [this]() { updateEnabledState(); }); connect(target->project(), &Project::parsingFinished, this, [this]() { updateEnabledState(); }); @@ -235,12 +233,11 @@ void RunConfiguration::setEnabled(bool enabled) QString RunConfiguration::disabledReason() const { - if (target()->project()->isParsing()) - return tr("The Project is currently being parsed."); - if (!target()->project()->hasParsingData()) { - QString msg = tr("The project could not be fully parsed."); + if (!project()->hasParsingData()) { + QString msg = project()->isParsing() ? tr("The project is currently being parsed.") + : tr("The project could not be fully parsed."); const FilePath projectFilePath = buildTargetInfo().projectFilePath; - if (!projectFilePath.exists()) + if (!projectFilePath.isEmpty() && !projectFilePath.exists()) msg += '\n' + tr("The project file \"%1\" does not exist.").arg(projectFilePath.toString()); return msg; } @@ -269,9 +266,7 @@ QWidget *RunConfiguration::createConfigurationWidget() void RunConfiguration::updateEnabledState() { - Project *p = target()->project(); - - setEnabled(!p->isParsing() && p->hasParsingData()); + setEnabled(project()->hasParsingData()); } void RunConfiguration::addAspectFactory(const AspectFactory &aspectFactory)