forked from qt-creator/qt-creator
ProjectExplorer: allow selecting targets without build config
Workspace projects do not have a build configuration by default, but a user might be interested in selecting different kits and manually create build steps. Change-Id: I641dc849f7f216201a1a6c0b51e73ce9c8c6b9ad Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -99,11 +99,11 @@ bool TargetSetupWidget::isKitSelected() const
|
||||
|
||||
void TargetSetupWidget::setKitSelected(bool b)
|
||||
{
|
||||
// Only check target if there are build configurations possible
|
||||
b &= hasSelectedBuildConfigurations();
|
||||
const GuardLocker locker(m_ignoreChanges);
|
||||
m_detailsWidget->setChecked(b);
|
||||
m_detailsWidget->setState(b ? DetailsWidget::Expanded : DetailsWidget::Collapsed);
|
||||
m_detailsWidget->setState(
|
||||
b && hasSelectableBuildConfigurations() ? DetailsWidget::Expanded
|
||||
: DetailsWidget::Collapsed);
|
||||
m_detailsWidget->widget()->setEnabled(b);
|
||||
}
|
||||
|
||||
@@ -236,16 +236,16 @@ const QList<BuildInfo> TargetSetupWidget::buildInfoList(const Kit *k, const File
|
||||
return {info};
|
||||
}
|
||||
|
||||
bool TargetSetupWidget::hasSelectedBuildConfigurations() const
|
||||
bool TargetSetupWidget::hasSelectableBuildConfigurations() const
|
||||
{
|
||||
return !selectedBuildInfoList().isEmpty();
|
||||
return !m_infoStore.empty();
|
||||
}
|
||||
|
||||
void TargetSetupWidget::toggleEnabled(bool enabled)
|
||||
{
|
||||
m_detailsWidget->widget()->setEnabled(enabled && hasSelectedBuildConfigurations());
|
||||
m_detailsWidget->widget()->setEnabled(enabled);
|
||||
m_detailsWidget->setCheckable(enabled);
|
||||
m_detailsWidget->setExpandable(enabled);
|
||||
m_detailsWidget->setExpandable(enabled && hasSelectableBuildConfigurations());
|
||||
if (!enabled) {
|
||||
m_detailsWidget->setState(DetailsWidget::Collapsed);
|
||||
m_detailsWidget->setChecked(false);
|
||||
@@ -254,6 +254,12 @@ void TargetSetupWidget::toggleEnabled(bool enabled)
|
||||
|
||||
const QList<BuildInfo> TargetSetupWidget::selectedBuildInfoList() const
|
||||
{
|
||||
if (m_infoStore.empty()) {
|
||||
BuildInfo info;
|
||||
info.kitId = m_kit->id();
|
||||
return {info};
|
||||
}
|
||||
|
||||
QList<BuildInfo> result;
|
||||
for (const BuildInfoStore &store : m_infoStore) {
|
||||
if (store.isEnabled)
|
||||
|
@@ -57,7 +57,7 @@ signals:
|
||||
private:
|
||||
static const QList<BuildInfo> buildInfoList(const Kit *k, const Utils::FilePath &projectPath);
|
||||
|
||||
bool hasSelectedBuildConfigurations() const;
|
||||
bool hasSelectableBuildConfigurations() const;
|
||||
|
||||
void toggleEnabled(bool enabled);
|
||||
void checkBoxToggled(QCheckBox *checkBox, bool b);
|
||||
|
Reference in New Issue
Block a user