+bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent* theEvent)
+{
+ // Let the manager decide what to do with the given key combination.
+ bool isAccepted = false;
+ switch (theEvent->key()) {
+ case Qt::Key_Escape: {
+ // processing in message box
+ if (myActiveMessageBox)
+ {
+ myActiveMessageBox->reject();
+ isAccepted = true;
+ }
+ // processing in the active widget
+ ModuleBase_Operation* aOperation = currentOperation();
+ if (!isAccepted && aOperation) {
+ ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
+ if (aPanel) {
+ ModuleBase_ModelWidget* anActiveWgt = aPanel->activeWidget();
+ if (anActiveWgt)
+ {
+ isAccepted = anActiveWgt && anActiveWgt->processAction(ActionEscape);
+ if (isAccepted) {
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
+ if (aFOperation)
+ aFOperation->setNeedToBeAborted(true);
+ }
+ }
+ }
+ }
+ if (!isAccepted)
+ {
+ XGUI_ActiveControlSelector* anActiveSelector =
+ XGUI_Tools::workshop(myWorkshop)->activeControlMgr()->activeSelector();
+ if (anActiveSelector && anActiveSelector->getType() == XGUI_FacesPanelSelector::Type())
+ isAccepted = XGUI_Tools::workshop(myWorkshop)->facesPanel()->processAction(ActionEscape);
+ }
+ // default Escape button functionality
+ if (!isAccepted && aOperation) {
+ onAbortOperation();
+ isAccepted = true;
+ }
+ }
+ break;
+ case Qt::Key_H:
+ if ((theEvent->modifiers() == Qt::NoModifier))
+ myWorkshop->viewer()->showSelectionHighlight();
+ break;
+ }
+ return isAccepted;
+}
+