forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user