}
~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<QKeyEvent*>(theEvent);
if(aKeyEvent) {
switch (aKeyEvent->key()) {
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,
/// 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;
ModuleBase_ModelWidget* anActiveWgt = 0;
// firstly the widget should process Delete action
ModuleBase_IPropertyPanel* aPanel;
+ bool isPPChildObject = false;
if (aOperation) {
aPanel = aOperation->propertyPanel();
- if (aPanel)
- anActiveWgt = aPanel->activeWidget();
- if (anActiveWgt) {
- isAccepted = anActiveWgt->processDelete();
+ if (aPanel) {
+ isPPChildObject = isChildObject(theObject, aPanel);
+ // process delete in active widget only if delete sender is child of property panel
+ // it is necessary for the case when OB is shown, user perform selection and click Delete
+ if (isPPChildObject) {
+ anActiveWgt = aPanel->activeWidget();
+ if (anActiveWgt) {
+ isAccepted = anActiveWgt->processDelete();
+ }
+ }
}
}
if (!isAccepted) {
/// processing delete by workshop
XGUI_ObjectsBrowser* aBrowser = workshop()->objectBrowser();
QWidget* aViewPort = myWorkshop->viewer()->activeViewPort();
- if (isChildObject(theObject, aBrowser) ||
- isChildObject(theObject, aViewPort))
+ // 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();
isAccepted = true;
}