ProjectExplorer: Consolidate creation of KitAspect's "Manage..."

Change-Id: I001a21f41bcd5ff0614bdf98893b56137c06546f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2023-08-22 10:25:30 +02:00
parent 04eea22c5f
commit fc7c11fb65
10 changed files with 41 additions and 52 deletions

View File

@@ -227,13 +227,12 @@ public:
refresh();
m_manageButton = createManageButton(Constants::TOOLCHAIN_SETTINGS_PAGE_ID);
setManagingPage(Constants::TOOLCHAIN_SETTINGS_PAGE_ID);
}
~ToolChainKitAspectImpl() override
{
delete m_mainWidget;
delete m_manageButton;
}
private:
@@ -241,7 +240,6 @@ private:
{
addMutableAction(m_mainWidget);
builder.addItem(m_mainWidget);
builder.addItem(m_manageButton);
}
void refresh() override
@@ -313,7 +311,6 @@ private:
}
QWidget *m_mainWidget = nullptr;
QWidget *m_manageButton = nullptr;
QHash<Id, QComboBox *> m_languageComboboxMap;
Guard m_ignoreChanges;
bool m_isReadOnly = false;
@@ -869,11 +866,11 @@ public:
m_comboBox(createSubWidget<QComboBox>()),
m_model(new DeviceManagerModel(DeviceManager::instance()))
{
setManagingPage(Constants::DEVICE_SETTINGS_PAGE_ID);
m_comboBox->setSizePolicy(QSizePolicy::Preferred,
m_comboBox->sizePolicy().verticalPolicy());
m_comboBox->setModel(m_model);
m_comboBox->setMinimumContentsLength(16); // Don't stretch too much for Kit Page
m_manageButton = createManageButton(Constants::DEVICE_SETTINGS_PAGE_ID);
refresh();
m_comboBox->setToolTip(factory->description());
@@ -889,7 +886,6 @@ public:
{
delete m_comboBox;
delete m_model;
delete m_manageButton;
}
private:
@@ -897,7 +893,6 @@ private:
{
addMutableAction(m_comboBox);
builder.addItem(m_comboBox);
builder.addItem(m_manageButton);
}
void makeReadOnly() override { m_comboBox->setEnabled(false); }
@@ -929,7 +924,6 @@ private:
Guard m_ignoreChanges;
QComboBox *m_comboBox;
QWidget *m_manageButton;
DeviceManagerModel *m_model;
Id m_selectedId;
};
@@ -1153,9 +1147,9 @@ public:
m_comboBox(createSubWidget<QComboBox>()),
m_model(new DeviceManagerModel(DeviceManager::instance()))
{
setManagingPage(Constants::DEVICE_SETTINGS_PAGE_ID);
m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
m_comboBox->setModel(m_model);
m_manageButton = createManageButton(Constants::DEVICE_SETTINGS_PAGE_ID);
refresh();
m_comboBox->setToolTip(factory->description());
@@ -1171,7 +1165,6 @@ public:
{
delete m_comboBox;
delete m_model;
delete m_manageButton;
}
private:
@@ -1179,7 +1172,6 @@ private:
{
addMutableAction(m_comboBox);
builder.addItem(m_comboBox);
builder.addItem(m_manageButton);
}
void makeReadOnly() override { m_comboBox->setEnabled(false); }
@@ -1219,7 +1211,6 @@ private:
Guard m_ignoreChanges;
QComboBox *m_comboBox;
QWidget *m_manageButton;
DeviceManagerModel *m_model;
Id m_selectedId;
};