CMake: Add a reset button to the CMake Configuration edit in Kits

Add a reset button to the CMake configuration edit dialog that is
available in the kits configuration panel. It restores the default
value for the kit.

Change-Id: I89921e2c86cbf8d9658a32fe5fa51dc2f903ff00
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2016-04-06 15:29:39 +02:00
parent 9ceb9cd777
commit 58c326cb73
3 changed files with 21 additions and 5 deletions

View File

@@ -344,13 +344,20 @@ void CMakeConfigurationKitConfigWidget::editConfigurationChanges()
"separated from the variable value by \"=\".<br>"
"You may provide a type hint by adding \":TYPE\" before the \"=\"."));
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Apply|QDialogButtonBox::Cancel);
auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Apply
|QDialogButtonBox::Reset|QDialogButtonBox::Cancel);
layout->addWidget(m_editor);
layout->addWidget(buttons);
connect(buttons, &QDialogButtonBox::accepted, m_dialog, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, m_dialog, &QDialog::reject);
connect(buttons, &QDialogButtonBox::clicked, m_dialog, [buttons, this](QAbstractButton *button) {
if (button != buttons->button(QDialogButtonBox::Reset))
return;
CMakeConfigurationKitInformation::setConfiguration(kit(),
CMakeConfigurationKitInformation::defaultConfiguration(kit()));
});
connect(m_dialog, &QDialog::accepted, this, &CMakeConfigurationKitConfigWidget::acceptChangesDialog);
connect(m_dialog, &QDialog::rejected, this, &CMakeConfigurationKitConfigWidget::closeChangesDialog);
connect(buttons->button(QDialogButtonBox::Apply), &QAbstractButton::clicked,