From fb27d5394a828d2fa895db6a8a643593913b9dc0 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 4 Oct 2017 11:19:44 +0300 Subject: [PATCH] Message box should not be opened again after Escape key click. --- src/XGUI/XGUI_OperationMgr.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 12a9e1bd6..abb8d3e28 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -241,11 +241,9 @@ bool XGUI_OperationMgr::abortAllOperations(const XGUI_MessageKind& theMessageKin } else { if (theMessageKind == XGUI_AbortOperationMessage) { - aResult = QMessageBox::question(qApp->activeWindow(), - tr("Abort operation"), - tr("All active operations will be aborted."), - QMessageBox::Ok | QMessageBox::Cancel, - QMessageBox::Cancel) == QMessageBox::Ok; + myActiveMessageBox = createMessageBox(tr("All active operations will be aborted.")); + aResult = myActiveMessageBox->exec() == QMessageBox::Ok; + myActiveMessageBox = 0; } else if (theMessageKind == XGUI_InformationMessage) { QString aMessage = tr("Please validate all your active operations before saving."); @@ -332,11 +330,9 @@ bool XGUI_OperationMgr::canStopOperation(ModuleBase_Operation* theOperation, if (theOperation && theOperation->isModified()) { if (theMessageKind == XGUI_AbortOperationMessage) { QString aMessage = tr("%1 operation will be aborted.").arg(theOperation->id()); - int anAnswer = QMessageBox::question(qApp->activeWindow(), - tr("Abort operation"), - aMessage, - QMessageBox::Ok | QMessageBox::Cancel, - QMessageBox::Cancel); + myActiveMessageBox = createMessageBox(aMessage); + int anAnswer = myActiveMessageBox->exec() == QMessageBox::Ok; + myActiveMessageBox = 0; return anAnswer == QMessageBox::Ok; } else if (theMessageKind == XGUI_InformationMessage) { -- 2.39.2