bool ModuleBase_ModelWidget::processDelete()
{
- return false;
+ // we consider that model objects eats delete key in order to
+ // do nothing by for example symbol delete in line edit or spin box
+ return true;
}
bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent)
if (aOperation) {
/// If last line finished on vertex the lines creation sequence has to be break
ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
- ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
- // if there is an active widget, find the presented object in it
- if (!anActiveWidget)
- anActiveWidget = aPanel->preselectionWidget();
+ if (aPanel) {
+ ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
+ // if there is an active widget, find the presented object in it
+ if (!anActiveWidget)
+ anActiveWidget = aPanel->preselectionWidget();
- ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
- (anActiveWidget);
- if (aWidgetValidated)
- anObject = aWidgetValidated->findPresentedObject(theAIS);
+ ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
+ (anActiveWidget);
+ if (aWidgetValidated)
+ anObject = aWidgetValidated->findPresentedObject(theAIS);
+ }
}
return anObject;
}
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();
+ // property panel childe object is processed to process delete performed on Apply button of PP
if (isChildObject(theObject, aBrowser) ||
- isChildObject(theObject, aViewPort))
+ isChildObject(theObject, aViewPort) ||
+ isPPChildObject)
workshop()->deleteObjects();
isAccepted = true;
}