diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-08-09 16:09:29 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-08-12 12:20:50 +0000 |
commit | 9be30e4f27fba036214c378f0e2896d4c80b726a (patch) | |
tree | b353fcb487b5f29712ca05ccfce8087b0dab27fb /src/plugins/projectexplorer/targetsetupwidget.cpp | |
parent | a5da571ed574eed70380614c0f12d075fbe784fd (diff) |
ProjectExplorer: Improve target setup page
- Do not hide any kits, as that it not transparent to the user.
Instead, show all of them and disable the unsuitable ones, with
an explanatory tool tip.
- Keep the list of kits sorted after new ones have been added.
- Do not do tons of unnecessary layout operations when setting the
kit list up from scratch.
- Code clean-up.
Fixes: QTCREATORBUG-20018
Change-Id: I7823ec9c3e5be00c6791e61926999cea0d7e43df
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/targetsetupwidget.cpp')
-rw-r--r-- | src/plugins/projectexplorer/targetsetupwidget.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/targetsetupwidget.cpp b/src/plugins/projectexplorer/targetsetupwidget.cpp index 74af55d53a..a0a994a904 100644 --- a/src/plugins/projectexplorer/targetsetupwidget.cpp +++ b/src/plugins/projectexplorer/targetsetupwidget.cpp @@ -28,7 +28,6 @@ #include "buildconfiguration.h" #include "buildinfo.h" #include "projectexplorerconstants.h" -#include "kit.h" #include "kitmanager.h" #include "kitoptionspage.h" @@ -40,6 +39,7 @@ #include <utils/hostosinfo.h> #include <utils/pathchooser.h> #include <utils/qtcassert.h> +#include <utils/utilsicons.h> #include <QCheckBox> #include <QHBoxLayout> @@ -69,7 +69,6 @@ TargetSetupWidget::TargetSetupWidget(Kit *k, const FilePath &projectPath) : m_detailsWidget->setUseCheckBox(true); m_detailsWidget->setChecked(false); m_detailsWidget->setSummaryFontBold(true); - m_detailsWidget->setToolTip(m_kit->toHtml()); vboxLayout->addWidget(m_detailsWidget); auto panel = new Utils::FadingWidget(m_detailsWidget); @@ -227,6 +226,24 @@ void TargetSetupWidget::expandWidget() m_detailsWidget->setState(Utils::DetailsWidget::Expanded); } +void TargetSetupWidget::updateStatus(const Kit::Predicate &predicate) +{ + // Kits that we deem invalid get a warning icon, but users can still select them, + // e.g. in case we misdetected an ABI mismatch. + // Kits that don't fulfill the project predicate are not selectable, because we cannot + // guarantee that we can handle the project sensibly (e.g. qmake project without Qt). + if (predicate && !predicate(kit())) { + setEnabled(false); + m_detailsWidget->setToolTip(tr("You cannot use this kit, because it does not fulfill " + "the project's prerequisites.")); + return; + } + if (!kit()->isValid()) + m_detailsWidget->setIcon(Icons::CRITICAL.icon()); + setEnabled(true); + m_detailsWidget->setToolTip(m_kit->toHtml()); +} + const QList<BuildInfo> TargetSetupWidget::buildInfoList(const Kit *k, const FilePath &projectPath) { if (auto factory = BuildConfigurationFactory::find(k, projectPath)) |