X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_OperationMgr.cpp;h=3e6c412235cbbcaef8a5b84a0576d08f1632c321;hb=220bd2b37119be1c65abf88a88792445cb9d99f8;hp=0f622a24c327a147c22c7493ce3abecb52a6d67d;hpb=ae8d4a42b1048fb3144c8c436019a86f734914f4;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 0f622a24c..3e6c41223 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -48,11 +48,14 @@ public: } ~XGUI_ShortCutListener() {} + /// Switch on short cut listener + void setActive(const bool theIsActive) { myIsActive = theIsActive; } + /// Redefinition of virtual function to process Delete key release virtual bool eventFilter(QObject *theObject, QEvent *theEvent) { bool isAccepted = false; - if (theEvent->type() == QEvent::KeyRelease) { + if (myIsActive && theEvent->type() == QEvent::KeyRelease) { QKeyEvent* aKeyEvent = dynamic_cast(theEvent); if(aKeyEvent) { switch (aKeyEvent->key()) { @@ -69,6 +72,7 @@ public: private: XGUI_OperationMgr* myOperationMgr; /// processor for key event + bool myIsActive; /// boolean state whether the event filter perform own signal processing }; XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent, @@ -78,13 +82,23 @@ XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent, /// we need to install filter to the application in order to react to 'Delete' key button /// this key can not be a short cut for a corresponded action because we need to set /// the actions priority - XGUI_ShortCutListener* aShortCutListener = new XGUI_ShortCutListener(theParent, this); + myShortCutListener = new XGUI_ShortCutListener(theParent, this); } XGUI_OperationMgr::~XGUI_OperationMgr() { } +void XGUI_OperationMgr::activate() +{ + myShortCutListener->setActive(true); +} + +void XGUI_OperationMgr::deactivate() +{ + myShortCutListener->setActive(false); +} + ModuleBase_Operation* XGUI_OperationMgr::currentOperation() const { return myOperations.count() > 0 ? myOperations.last() : 0; @@ -652,8 +666,8 @@ bool XGUI_OperationMgr::onProcessDelete(QObject* theObject) /// processing delete by workshop XGUI_ObjectsBrowser* aBrowser = workshop()->objectBrowser(); QWidget* aViewPort = myWorkshop->viewer()->activeViewPort(); - // property panel childe object is processed to process delete performed on Apply button of PP - if (isChildObject(theObject, aBrowser) || + // property panel child object is processed to process delete performed on Apply button of PP + if (theObject == aBrowser->treeView() || isChildObject(theObject, aViewPort) || isPPChildObject) workshop()->deleteObjects();