+bool XGUI_OperationMgr::onProcessEnter(QObject* theObject)
+{
+ bool isAccepted = false;
+ ModuleBase_Operation* aOperation = currentOperation();
+ ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
+ // only property panel enter is processed in order to do not process enter in application dialogs
+ bool isPPChild = isChildObject(theObject, aPanel);
+ if (!isPPChild)
+ return isAccepted;
+
+ ModuleBase_ModelWidget* anActiveWgt = aPanel->activeWidget();
+ bool isAborted = false;
+ if (!anActiveWgt) {
+ QWidget* aFocusWidget = aPanel->focusWidget();
+ QToolButton* aCancelBtn = aPanel->findChild<QToolButton*>(PROP_PANEL_CANCEL);
+ if (aFocusWidget && aCancelBtn && aFocusWidget == aCancelBtn) {
+ abortOperation(aOperation);
+ isAccepted = true;
+ isAborted = true;
+ }
+ }
+ if (!isAborted) {
+ isAccepted = anActiveWgt && anActiveWgt->processEnter();
+ if (!isAccepted) {
+ isAccepted = myWorkshop->module()->processEnter(anActiveWgt ? anActiveWgt->attributeID() : "");
+ if (!isAccepted) {
+ /// functionality is similar to Apply click
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
+ if (!aFOperation || myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) {
+ // key released is emitted to apply the current value to the model if it was modified in PP
+ emit keyEnterReleased();
+ commitOperation();
+ isAccepted = true;
+ }
+ else
+ isAccepted = false;
+ }
+ }
+ }
+ return isAccepted;
+}
+
+bool XGUI_OperationMgr::onProcessDelete(QObject* theObject)
+{
+ bool isAccepted = false;
+ ModuleBase_Operation* aOperation = currentOperation();
+ ModuleBase_ModelWidget* anActiveWgt = 0;
+ // firstly the widget should process Delete action
+ ModuleBase_IPropertyPanel* aPanel;
+ bool isPPChildObject = false;
+ if (aOperation) {
+ aPanel = aOperation->propertyPanel();
+ 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) {
+ // after widget, object browser and viewer should process delete
+ /// other widgets such as line edit controls should not lead to
+ /// processing delete by workshop
+ XGUI_ObjectsBrowser* aBrowser = workshop()->objectBrowser();
+ QWidget* aViewPort = myWorkshop->viewer()->activeViewPort();
+ // 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;
+ }
+
+ return isAccepted;
+}
+