diff options
author | Artem Sokolovskii <artem.sokolovskii@qt.io> | 2022-04-14 15:51:18 +0200 |
---|---|---|
committer | Artem Sokolovskii <artem.sokolovskii@qt.io> | 2022-05-24 10:02:45 +0000 |
commit | 7954c4cc6998b0d64581b8d3459e36a2ecfa255f (patch) | |
tree | 5250ecfd38e6359033ea8941fb1e4850349e80da /src/plugins/autotest/projectsettingswidget.cpp | |
parent | 6c05ed7920b612089bc9ccc2d3416deb0680c3e7 (diff) | |
download | qt-creator-7954c4cc6998b0d64581b8d3459e36a2ecfa255f.tar.gz |
ProjectExplorer: Add a common template for project settings
- Added base widget class for common options among project settings tabs
- Added usage new template class to all pages used in project settings
ToDo
- Make CodeStyle tab standardized
Change-Id: I8f70413b6ee764c5e43fbeae104b9389237c582f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/autotest/projectsettingswidget.cpp')
-rw-r--r-- | src/plugins/autotest/projectsettingswidget.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/plugins/autotest/projectsettingswidget.cpp b/src/plugins/autotest/projectsettingswidget.cpp index f4ede604fc..34152ff7be 100644 --- a/src/plugins/autotest/projectsettingswidget.cpp +++ b/src/plugins/autotest/projectsettingswidget.cpp @@ -25,6 +25,7 @@ #include "projectsettingswidget.h" +#include "autotestconstants.h" #include "autotestplugin.h" #include "testframeworkmanager.h" #include "testprojectsettings.h" @@ -53,14 +54,12 @@ static QSpacerItem *createSpacer(QSizePolicy::Policy horizontal, QSizePolicy::Po ProjectTestSettingsWidget::ProjectTestSettingsWidget(ProjectExplorer::Project *project, QWidget *parent) - : QWidget(parent) + : ProjectExplorer::ProjectSettingsWidget(parent) , m_projectSettings(AutotestPlugin::projectSettings(project)) { + setGlobalSettingsId(Constants::AUTOTEST_SETTINGS_ID); auto verticalLayout = new QVBoxLayout(this); verticalLayout->setContentsMargins(0, 0, 0, 0); - m_useGlobalSettings = new QComboBox; - m_useGlobalSettings->addItem(tr("Global")); - m_useGlobalSettings->addItem(tr("Custom")); auto generalWidget = new QWidget; auto groupBoxLayout = new QVBoxLayout; @@ -83,29 +82,26 @@ ProjectTestSettingsWidget::ProjectTestSettingsWidget(ProjectExplorer::Project *p generalWidget->setLayout(groupBoxLayout); horizontalLayout = new QHBoxLayout; - horizontalLayout->addWidget(m_useGlobalSettings); - horizontalLayout->addItem(createSpacer(QSizePolicy::Expanding, QSizePolicy::Minimum)); - verticalLayout->addLayout(horizontalLayout); - horizontalLayout = new QHBoxLayout; verticalLayout->addItem(createSpacer(QSizePolicy::Minimum, QSizePolicy::Fixed)); horizontalLayout->addWidget(generalWidget); horizontalLayout->addItem(createSpacer(QSizePolicy::Expanding, QSizePolicy::Minimum)); verticalLayout->addLayout(horizontalLayout); verticalLayout->addItem(createSpacer(QSizePolicy::Minimum, QSizePolicy::Expanding)); - m_useGlobalSettings->setCurrentIndex(m_projectSettings->useGlobalSettings() ? 0 : 1); generalWidget->setDisabled(m_projectSettings->useGlobalSettings()); populateFrameworks(m_projectSettings->activeFrameworks(), m_projectSettings->activeTestTools()); - connect(m_useGlobalSettings, QOverload<int>::of(&QComboBox::currentIndexChanged), - this, [this, generalWidget](int index) { - generalWidget->setEnabled(index != 0); - m_projectSettings->setUseGlobalSettings(index == 0); - m_syncTimer.start(3000); - m_syncType = ITestBase::Framework | ITestBase::Tool; - }); + setUseGlobalSettings(m_projectSettings->useGlobalSettings()); + connect(this, &ProjectSettingsWidget::useGlobalSettingsChanged, + this, [this, generalWidget](bool useGlobalSettings) { + generalWidget->setEnabled(!useGlobalSettings); + m_projectSettings->setUseGlobalSettings(useGlobalSettings); + m_syncTimer.start(3000); + m_syncType = ITestBase::Framework | ITestBase::Tool; + }); + connect(m_activeFrameworks, &QTreeWidget::itemChanged, this, &ProjectTestSettingsWidget::onActiveFrameworkChanged); connect(m_runAfterBuild, QOverload<int>::of(&QComboBox::currentIndexChanged), |