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 <marcus.tillmanns@qt.io>
This commit is contained in:
David Schulz
2024-10-04 06:09:09 +02:00
parent 92e6b7061b
commit ffd8f8326d
4 changed files with 16 additions and 4 deletions

View File

@@ -294,6 +294,14 @@ void BaseAspect::addLabeledItem(Layout &parent, QWidget *widget)
}
}
void BaseAspect::addLabeledItems(Layouting::Layout &parent, const QList<QWidget *> &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.

View File

@@ -237,6 +237,7 @@ protected:
QLabel *createLabel();
void addLabeledItem(Layouting::Layout &parent, QWidget *widget);
void addLabeledItems(Layouting::Layout &parent, const QList<QWidget *> &widgets);
void setDataCreatorHelper(const DataCreator &creator) const;
void setDataClonerHelper(const DataCloner &cloner) const;

View File

@@ -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);
}

View File

@@ -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};