ProjectExplorer: Base KitAspectWidget on BaseAspect

Enables re-using existing functionality.

The "Make mutable" functionality is still oddly placed. I doubt people
find and use it actively.

Change-Id: Ic6aae17e3a7df093f0f5f234f1e6e1afc196a087
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-04-07 18:55:21 +02:00
parent 2727016f1d
commit 77481f25ce
14 changed files with 182 additions and 121 deletions

View File

@@ -39,8 +39,8 @@ ToolKitAspectWidget::ToolKitAspectWidget(ProjectExplorer::Kit *kit,
const ProjectExplorer::KitAspect *ki,
ToolType type)
: ProjectExplorer::KitAspectWidget(kit, ki)
, m_toolsComboBox{new QComboBox}
, m_manageButton(new QPushButton(KitAspectWidget::msgManage()))
, m_toolsComboBox(createSubWidget<QComboBox>())
, m_manageButton(createSubWidget<QPushButton>(KitAspectWidget::msgManage()))
, m_type{type}
{
m_toolsComboBox->setSizePolicy(QSizePolicy::Ignored,
@@ -51,7 +51,7 @@ ToolKitAspectWidget::ToolKitAspectWidget(ProjectExplorer::Kit *kit,
m_manageButton->setContentsMargins(0, 0, 0, 0);
connect(m_manageButton, &QPushButton::clicked, this, [this]() {
Core::ICore::showOptionsDialog(Constants::SettingsPage::TOOLS_ID, buttonWidget());
Core::ICore::showOptionsDialog(Constants::SettingsPage::TOOLS_ID, m_manageButton);
});
connect(MesonTools::instance(),

View File

@@ -30,6 +30,8 @@
#include <projectexplorer/kitmanager.h>
#include <utils/layoutbuilder.h>
#include <QComboBox>
#include <QCoreApplication>
#include <QPushButton>
@@ -58,8 +60,14 @@ private:
void setToDefault();
void makeReadOnly() override { m_toolsComboBox->setEnabled(false); }
QWidget *mainWidget() const override { return m_toolsComboBox; }
QWidget *buttonWidget() const override { return m_manageButton; }
void addToLayout(Utils::LayoutBuilder &builder) override
{
addMutableAction(m_toolsComboBox);
builder.addItem(m_toolsComboBox);
builder.addItem(m_manageButton);
}
void refresh() override
{
const auto id = [this]() {