forked from qt-creator/qt-creator
ProjectExplorer: Let KitAspect pre-select a settings page item
... when the "Manage" button is clicked. Make use of this in the device settings page. Fixes: QTCREATORBUG-25077 Change-Id: I1173a72d4c538c839c3e8df278a698b74bd6fca2 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -190,7 +190,13 @@ DeviceSettingsWidget::DeviceSettingsWidget()
|
||||
|
||||
addButton->setEnabled(hasDeviceFactories);
|
||||
|
||||
int lastIndex = ICore::settings()->value(LastDeviceIndexKey, 0).toInt();
|
||||
int lastIndex = -1;
|
||||
if (const Id deviceToSelect = preselectedOptionsPageItem(Constants::DEVICE_SETTINGS_PAGE_ID);
|
||||
deviceToSelect.isValid()) {
|
||||
lastIndex = m_deviceManagerModel->indexForId(deviceToSelect);
|
||||
}
|
||||
if (lastIndex == -1)
|
||||
lastIndex = ICore::settings()->value(LastDeviceIndexKey, 0).toInt();
|
||||
if (lastIndex == -1)
|
||||
lastIndex = 0;
|
||||
if (lastIndex < m_configurationComboBox->count())
|
||||
|
@@ -897,6 +897,8 @@ private:
|
||||
|
||||
void makeReadOnly() override { m_comboBox->setEnabled(false); }
|
||||
|
||||
Id settingsPageItemToPreselect() const override { return DeviceKitAspect::deviceId(m_kit); }
|
||||
|
||||
void refresh() override
|
||||
{
|
||||
m_model->setTypeFilter(DeviceTypeKitAspect::deviceTypeId(m_kit));
|
||||
|
@@ -796,7 +796,7 @@ void KitAspect::addToLayout(Layouting::LayoutItem &parentItem)
|
||||
if (m_managingPageId.isValid()) {
|
||||
m_manageButton = createSubWidget<QPushButton>(msgManage());
|
||||
connect(m_manageButton, &QPushButton::clicked, [this] {
|
||||
Core::ICore::showOptionsDialog(m_managingPageId);
|
||||
Core::ICore::showOptionsDialog(m_managingPageId, settingsPageItemToPreselect());
|
||||
});
|
||||
parentItem.addItem(m_manageButton);
|
||||
}
|
||||
|
@@ -125,6 +125,7 @@ public:
|
||||
protected:
|
||||
virtual void makeReadOnly() {}
|
||||
virtual void addToLayoutImpl(Layouting::LayoutItem &parentItem) = 0;
|
||||
virtual Utils::Id settingsPageItemToPreselect() const { return {}; }
|
||||
|
||||
Kit *m_kit;
|
||||
const KitAspectFactory *m_factory;
|
||||
|
Reference in New Issue
Block a user