summaryrefslogtreecommitdiff
path: root/src/plugins/cmakeprojectmanager
diff options
context:
space:
mode:
authorClaus Steuer <claus755@gmail.com>2017-07-16 10:41:54 +0200
committerClaus Steuer <claus755@gmail.com>2017-07-19 04:31:02 +0000
commitd105ac8255b90ec96a82c70e9c6a8ab5f281be23 (patch)
treea6571c029a6f0e80c3604cd1edefadb3a4c9e721 /src/plugins/cmakeprojectmanager
parent9916c0a759604d71f454db7ce62bfec305a6b280 (diff)
downloadqt-creator-d105ac8255b90ec96a82c70e9c6a8ab5f281be23.tar.gz
CMake: Fix "CMake configuration changed on disk" dialog
The dialog is shown when the cmake configuration changes. The user can either apply the changes or reject them. To determine the decision of the user the return value of the dialog is evaluated. This is wrong because the dialog uses custom buttons (see documentation of QMessageBox::exec). As a consequence the configuration is never applied. Use QMessageBox::clickedButton to determine the user decision. Additionally change the role of the apply button from AcceptRole to ApplyRole as this better matches its intention. Change-Id: I1d2d1fb7186dcc8d789c192c51bb34111eb84ee5 Task-number: QTCREATORBUG-18292 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager')
-rw-r--r--src/plugins/cmakeprojectmanager/builddirmanager.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.cpp b/src/plugins/cmakeprojectmanager/builddirmanager.cpp
index 2a28093c1f..86d9e0945f 100644
--- a/src/plugins/cmakeprojectmanager/builddirmanager.cpp
+++ b/src/plugins/cmakeprojectmanager/builddirmanager.cpp
@@ -45,6 +45,7 @@
#include <utils/qtcassert.h>
#include <QMessageBox>
+#include <QPushButton>
#include <QSet>
using namespace ProjectExplorer;
@@ -428,11 +429,11 @@ void BuildDirManager::checkConfiguration()
box->setText(tr("CMake configuration has changed on disk."));
box->setInformativeText(tr("The CMakeCache.txt file has changed: %1").arg(table));
auto *defaultButton = box->addButton(tr("Overwrite Changes in CMake"), QMessageBox::RejectRole);
- box->addButton(tr("Apply Changes to Project"), QMessageBox::AcceptRole);
+ auto *applyButton = box->addButton(tr("Apply Changes to Project"), QMessageBox::ApplyRole);
box->setDefaultButton(defaultButton);
- int ret = box->exec();
- if (ret == QMessageBox::Apply)
+ box->exec();
+ if (box->clickedButton() == applyButton)
m_buildConfiguration->setCMakeConfiguration(newConfig);
}
}