From ffd8f8326d5d964c893484df4bfd53ad43a68252 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 4 Oct 2024 06:09:09 +0200 Subject: [PATCH] ProjectExplorer: disable workspace runconfiguration container ... instead of the individual aspects. The widgets of ArgumentsAspect and WorkingDirectoryAspect needs to be registered as subwidgets. Otherwise the enabled state is not propagated from the container to the individual aspects. Change-Id: I6f96db8041386b41d6414ec865e7213940bbe78f Reviewed-by: Marcus Tillmanns --- src/libs/utils/aspects.cpp | 8 ++++++++ src/libs/utils/aspects.h | 1 + src/plugins/projectexplorer/runconfigurationaspects.cpp | 7 ++++++- src/plugins/projectexplorer/workspaceproject.cpp | 4 +--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/libs/utils/aspects.cpp b/src/libs/utils/aspects.cpp index 07150b3d00a..bd84a41614a 100644 --- a/src/libs/utils/aspects.cpp +++ b/src/libs/utils/aspects.cpp @@ -294,6 +294,14 @@ void BaseAspect::addLabeledItem(Layout &parent, QWidget *widget) } } +void BaseAspect::addLabeledItems(Layouting::Layout &parent, const QList &widgets) +{ + if (QLabel *l = createLabel()) + parent.addItem(l); + for (auto widget : widgets) + parent.addItem(widget); +} + /*! Sets \a labelText as text for the separate label in the visual representation of this aspect. diff --git a/src/libs/utils/aspects.h b/src/libs/utils/aspects.h index f1c59c908b2..6cac1b6e8e2 100644 --- a/src/libs/utils/aspects.h +++ b/src/libs/utils/aspects.h @@ -237,6 +237,7 @@ protected: QLabel *createLabel(); void addLabeledItem(Layouting::Layout &parent, QWidget *widget); + void addLabeledItems(Layouting::Layout &parent, const QList &widgets); void setDataCreatorHelper(const DataCreator &creator) const; void setDataClonerHelper(const DataCloner &cloner) const; diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 936a28a849c..a7d2186995c 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -157,6 +157,7 @@ WorkingDirectoryAspect::WorkingDirectoryAspect(AspectContainer *container) : BaseAspect(container) { setDisplayName(Tr::tr("Working Directory")); + setLabelText(Tr::tr("Working directory:")); setId("WorkingDirectoryAspect"); setSettingsKey("RunConfiguration.WorkingDirectory"); } @@ -206,7 +207,10 @@ void WorkingDirectoryAspect::addToLayoutImpl(Layout &builder) m_chooser->setReadOnly(isReadOnly()); m_resetButton->setEnabled(!isReadOnly()); - builder.addItems({Tr::tr("Working directory:"), m_chooser.data(), m_resetButton.data()}); + registerSubWidget(m_chooser); + registerSubWidget(m_resetButton); + + addLabeledItems(builder, {m_chooser.data(), m_resetButton.data()}); } void WorkingDirectoryAspect::resetPath() @@ -492,6 +496,7 @@ void ArgumentsAspect::addToLayoutImpl(Layout &builder) containerLayout->addWidget(m_resetButton); containerLayout->setAlignment(m_resetButton, Qt::AlignTop); } + registerSubWidget(container); addLabeledItem(builder, container); } diff --git a/src/plugins/projectexplorer/workspaceproject.cpp b/src/plugins/projectexplorer/workspaceproject.cpp index 61e2b4b6894..f5ca390bc85 100644 --- a/src/plugins/projectexplorer/workspaceproject.cpp +++ b/src/plugins/projectexplorer/workspaceproject.cpp @@ -368,7 +368,6 @@ public: const BuildTargetInfo bti = buildTargetInfo(); executable.setLabelText(Tr::tr("Executable:")); - executable.setReadOnly(true); executable.setValue(bti.targetFilePath); auto argumentsAsString = [this]() { @@ -378,12 +377,10 @@ public: }; arguments.setLabelText(Tr::tr("Arguments:")); - arguments.setReadOnly(true); arguments.setMacroExpander(macroExpander()); arguments.setArguments(argumentsAsString()); workingDirectory.setLabelText(Tr::tr("Working directory:")); - workingDirectory.setReadOnly(true); workingDirectory.setDefaultWorkingDirectory(bti.workingDirectory); setCommandLineGetter([this] { @@ -405,6 +402,7 @@ public: }); connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); + setEnabled(false); } TextDisplay hint{this};