ProjectExplorer: Move use of some knowledge from KitAspectWidget to KitAspect

Essentially a follow-up to 09a7d2bd45.

Change-Id: I4dd9d64eec77ddf9cdccbac808e9a0978b9986bf
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-02-11 17:10:03 +01:00
parent 1d23f8b93d
commit 470ce8a856
8 changed files with 11 additions and 13 deletions

View File

@@ -80,7 +80,7 @@ public:
{ {
m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy()); m_comboBox->setSizePolicy(QSizePolicy::Ignored, m_comboBox->sizePolicy().verticalPolicy());
m_comboBox->setEnabled(false); m_comboBox->setEnabled(false);
m_comboBox->setToolTip(toolTip()); m_comboBox->setToolTip(ki->description());
foreach (CMakeTool *tool, CMakeToolManager::cmakeTools()) foreach (CMakeTool *tool, CMakeToolManager::cmakeTools())
cmakeToolAdded(tool->id()); cmakeToolAdded(tool->id());
@@ -328,7 +328,7 @@ public:
m_label(new QLabel), m_label(new QLabel),
m_changeButton(new QPushButton) m_changeButton(new QPushButton)
{ {
m_label->setToolTip(toolTip()); m_label->setToolTip(ki->description());
m_changeButton->setText(tr("Change...")); m_changeButton->setText(tr("Change..."));
refresh(); refresh();
connect(m_changeButton, &QPushButton::clicked, connect(m_changeButton, &QPushButton::clicked,

View File

@@ -67,6 +67,7 @@ public:
m_comboBox->setEnabled(true); m_comboBox->setEnabled(true);
refresh(); refresh();
m_comboBox->setToolTip(ki->description());
connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DebuggerKitAspectWidget::currentDebuggerChanged); this, &DebuggerKitAspectWidget::currentDebuggerChanged);
@@ -96,7 +97,6 @@ private:
{ {
m_ignoreChanges = true; m_ignoreChanges = true;
m_comboBox->clear(); m_comboBox->clear();
m_comboBox->setToolTip(toolTip());
m_comboBox->addItem(tr("None"), QString()); m_comboBox->addItem(tr("None"), QString());
for (const DebuggerItem &item : DebuggerItemManager::debuggers()) for (const DebuggerItem &item : DebuggerItemManager::debuggers())
m_comboBox->addItem(item.displayName(), item.id()); m_comboBox->addItem(item.displayName(), item.id());

View File

@@ -243,7 +243,7 @@ public:
layout->addWidget(new QLabel(ToolChainManager::displayNameOfLanguageId(l) + ':'), row, 0); layout->addWidget(new QLabel(ToolChainManager::displayNameOfLanguageId(l) + ':'), row, 0);
auto cb = new QComboBox; auto cb = new QComboBox;
cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy()); cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy());
cb->setToolTip(toolTip()); cb->setToolTip(ki->description());
m_languageComboboxMap.insert(l, cb); m_languageComboboxMap.insert(l, cb);
layout->addWidget(cb, row, 1); layout->addWidget(cb, row, 1);
@@ -768,7 +768,7 @@ public:
{ {
for (IDeviceFactory *factory : IDeviceFactory::allDeviceFactories()) for (IDeviceFactory *factory : IDeviceFactory::allDeviceFactories())
m_comboBox->addItem(factory->displayName(), factory->deviceType().toSetting()); m_comboBox->addItem(factory->displayName(), factory->deviceType().toSetting());
m_comboBox->setToolTip(toolTip()); m_comboBox->setToolTip(ki->description());
refresh(); refresh();
connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DeviceTypeKitAspectWidget::currentTypeChanged); this, &DeviceTypeKitAspectWidget::currentTypeChanged);
@@ -893,7 +893,7 @@ public:
m_comboBox->setModel(m_model); m_comboBox->setModel(m_model);
m_manageButton = new QPushButton(KitAspectWidget::msgManage()); m_manageButton = new QPushButton(KitAspectWidget::msgManage());
refresh(); refresh();
m_comboBox->setToolTip(toolTip()); m_comboBox->setToolTip(ki->description());
connect(m_model, &QAbstractItemModel::modelAboutToBeReset, connect(m_model, &QAbstractItemModel::modelAboutToBeReset,
this, &DeviceKitAspectWidget::modelAboutToReset); this, &DeviceKitAspectWidget::modelAboutToReset);

View File

@@ -127,8 +127,6 @@ public:
KitAspectWidget(Kit *kit, const KitAspect *ki); KitAspectWidget(Kit *kit, const KitAspect *ki);
Core::Id kitInformationId() const; Core::Id kitInformationId() const;
QString displayName() const { return m_kitInformation->displayName(); }
QString toolTip() const { return m_kitInformation->description(); }
virtual void makeReadOnly() = 0; virtual void makeReadOnly() = 0;
virtual void refresh() = 0; virtual void refresh() = 0;

View File

@@ -218,8 +218,8 @@ void KitManagerConfigWidget::addAspectToWorkingCopy(KitAspect *aspect)
QTC_ASSERT(widget, return); QTC_ASSERT(widget, return);
QTC_ASSERT(!m_widgets.contains(widget), return); QTC_ASSERT(!m_widgets.contains(widget), return);
const QString name = widget->displayName() + ':'; const QString name = aspect->displayName() + ':';
QString toolTip = widget->toolTip(); QString toolTip = aspect->description();
auto action = new QAction(tr("Mark as Mutable"), nullptr); auto action = new QAction(tr("Mark as Mutable"), nullptr);
action->setCheckable(true); action->setCheckable(true);

View File

@@ -593,7 +593,7 @@ void KitAreaWidget::setKit(Kit *k)
if (k && k->isMutable(ki->id())) { if (k && k->isMutable(ki->id())) {
KitAspectWidget *widget = ki->createConfigWidget(k); KitAspectWidget *widget = ki->createConfigWidget(k);
m_widgets << widget; m_widgets << widget;
QLabel *label = new QLabel(widget->displayName()); QLabel *label = new QLabel(ki->displayName());
m_labels << label; m_labels << label;
widget->setStyle(QStyleFactory::create(QLatin1String("fusion"))); widget->setStyle(QStyleFactory::create(QLatin1String("fusion")));

View File

@@ -53,7 +53,7 @@ public:
: KitAspectWidget(k, ki), m_lineEdit(new QLineEdit) : KitAspectWidget(k, ki), m_lineEdit(new QLineEdit)
{ {
refresh(); // set up everything according to kit refresh(); // set up everything according to kit
m_lineEdit->setToolTip(toolTip()); m_lineEdit->setToolTip(ki->description());
connect(m_lineEdit, &QLineEdit::textEdited, this, &QmakeKitAspectWidget::mkspecWasChanged); connect(m_lineEdit, &QLineEdit::textEdited, this, &QmakeKitAspectWidget::mkspecWasChanged);
} }

View File

@@ -64,7 +64,7 @@ public:
m_manageButton = new QPushButton(KitAspectWidget::msgManage()); m_manageButton = new QPushButton(KitAspectWidget::msgManage());
refresh(); refresh();
m_combo->setToolTip(toolTip()); m_combo->setToolTip(ki->description());
connect(m_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &QtKitAspectWidget::currentWasChanged); this, &QtKitAspectWidget::currentWasChanged);