From: vsv Date: Fri, 6 Mar 2020 08:30:30 +0000 (+0300) Subject: Issue #18755 (Tuleap): Do not process key events if a modal window is displayed X-Git-Tag: V9_5_0a2~53 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a211165b993cec59888b300199b44b525c0daf69;p=modules%2Fshaper.git Issue #18755 (Tuleap): Do not process key events if a modal window is displayed --- diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 347a7e62f..53c92f32f 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -94,9 +94,13 @@ public: } } else if (theEvent->type() == QEvent::KeyPress) { - QKeyEvent* aKeyEvent = dynamic_cast(theEvent); - myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & Qt::ShiftModifier); - isAccepted = myOperationMgr->onKeyPressed(theObject, aKeyEvent); + if (!qApp->modalWindow()) { + if (myOperationMgr->hasOperation()) { + QKeyEvent* aKeyEvent = dynamic_cast(theEvent); + myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & Qt::ShiftModifier); + isAccepted = myOperationMgr->onKeyPressed(theObject, aKeyEvent); + } + } } } if (!isAccepted) @@ -446,7 +450,7 @@ void XGUI_OperationMgr::stopOperation(ModuleBase_Operation* theOperation, bool& void XGUI_OperationMgr::abortOperation(ModuleBase_Operation* theOperation) { ModuleBase_Operation* aCurrentOperation = currentOperation(); - if (theOperation == aCurrentOperation) + if (theOperation && (theOperation == aCurrentOperation)) theOperation->abort(); else { // it is possible to trigger upper operation(e.g. sketch, current is sketch line) @@ -723,15 +727,17 @@ bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent* theEvent) ModuleBase_Operation* aOperation = currentOperation(); if (!isAccepted && aOperation) { ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); - ModuleBase_ModelWidget* anActiveWgt = aPanel->activeWidget(); - if (anActiveWgt) - { - isAccepted = anActiveWgt && anActiveWgt->processAction(ActionEscape); - if (isAccepted) { - ModuleBase_OperationFeature* aFOperation = - dynamic_cast(currentOperation()); - if (aFOperation) - aFOperation->setNeedToBeAborted(true); + if (aPanel) { + ModuleBase_ModelWidget* anActiveWgt = aPanel->activeWidget(); + if (anActiveWgt) + { + isAccepted = anActiveWgt && anActiveWgt->processAction(ActionEscape); + if (isAccepted) { + ModuleBase_OperationFeature* aFOperation = + dynamic_cast(currentOperation()); + if (aFOperation) + aFOperation->setNeedToBeAborted(true); + } } } }