1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: XGUI_OperationMgr.cpp
4 // Created: 20 Apr 2014
5 // Author: Natalia ERMOLAEVA
7 #include "XGUI_OperationMgr.h"
8 #include "XGUI_ModuleConnector.h"
9 #include "XGUI_Workshop.h"
10 #include "XGUI_ErrorMgr.h"
11 #include "XGUI_Tools.h"
12 #include "XGUI_ObjectsBrowser.h"
13 #include "XGUI_ContextMenuMgr.h"
15 #include <ModuleBase_IPropertyPanel.h>
16 #include <ModuleBase_ModelWidget.h>
17 #include "ModuleBase_Operation.h"
18 #include "ModuleBase_IWorkshop.h"
19 #include "ModuleBase_IModule.h"
20 #include <ModuleBase_IViewer.h>
21 #include "ModuleBase_OperationDescription.h"
22 #include "ModuleBase_OperationFeature.h"
23 #include "ModuleBase_Tools.h"
25 #include "ModelAPI_CompositeFeature.h"
26 #include "ModelAPI_Session.h"
28 #include <XGUI_PropertyPanel.h>
29 #include <QToolButton>
32 #include <QMessageBox>
33 #include <QApplication>
36 //#define DEBUG_CURRENT_FEATURE
38 /// Processes "Delete" key event of application. This key is used by several application actions.
39 /// There is a logical order of the actions processing. So the key can not be set for actions
40 /// as a shortcut. The class listens the key event and call operation manager processor.
41 class XGUI_ShortCutListener : public QObject
45 /// \param theParent the parent to be deleted when the parent is deleted
46 /// \param theOperationMgr the class to perform deletion
47 XGUI_ShortCutListener(QObject* theParent, XGUI_OperationMgr* theOperationMgr)
48 : QObject(theParent), myOperationMgr(theOperationMgr)
50 qApp->installEventFilter(this);
52 ~XGUI_ShortCutListener() {}
54 /// Switch on short cut listener
55 void setActive(const bool theIsActive) { myIsActive = theIsActive; }
57 /// Redefinition of virtual function to process Delete key release
58 virtual bool eventFilter(QObject *theObject, QEvent *theEvent)
60 bool isAccepted = false;
61 if (myIsActive && theEvent->type() == QEvent::KeyRelease) {
62 QKeyEvent* aKeyEvent = dynamic_cast<QKeyEvent*>(theEvent);
64 switch (aKeyEvent->key()) {
65 case Qt::Key_Delete: {
66 isAccepted = myOperationMgr->onProcessDelete(theObject);
72 isAccepted = QObject::eventFilter(theObject, theEvent);
77 XGUI_OperationMgr* myOperationMgr; /// processor for key event
78 bool myIsActive; /// boolean state whether the event filter perform own signal processing
81 XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent,
82 ModuleBase_IWorkshop* theWorkshop)
83 : QObject(theParent), myWorkshop(theWorkshop)
85 /// we need to install filter to the application in order to react to 'Delete' key button
86 /// this key can not be a short cut for a corresponded action because we need to set
87 /// the actions priority
88 myShortCutListener = new XGUI_ShortCutListener(theParent, this);
91 XGUI_OperationMgr::~XGUI_OperationMgr()
95 void XGUI_OperationMgr::activate()
97 myShortCutListener->setActive(true);
100 void XGUI_OperationMgr::deactivate()
102 myShortCutListener->setActive(false);
105 ModuleBase_Operation* XGUI_OperationMgr::currentOperation() const
107 return myOperations.count() > 0 ? myOperations.last() : 0;
110 bool XGUI_OperationMgr::isCurrentOperation(ModuleBase_Operation* theOperation)
114 return currentOperation() == theOperation;
117 bool XGUI_OperationMgr::hasOperation() const
119 return !myOperations.isEmpty() && (myOperations.last() != NULL);
122 bool XGUI_OperationMgr::hasOperation(const QString& theId) const
124 foreach(ModuleBase_Operation* aOp, myOperations) {
125 if (aOp->id() == theId)
131 ModuleBase_Operation* XGUI_OperationMgr::findOperation(const QString& theId) const
133 QList<ModuleBase_Operation*>::const_iterator anIt = myOperations.end();
134 while (anIt != myOperations.begin()) {
136 ModuleBase_Operation* anOperation = *anIt;
137 if (anOperation->id() == theId)
144 int XGUI_OperationMgr::operationsCount() const
146 return myOperations.count();
149 QStringList XGUI_OperationMgr::operationList() const
152 foreach(ModuleBase_Operation* eachOperation, myOperations) {
153 ModuleBase_OperationFeature* aFOperation =
154 dynamic_cast<ModuleBase_OperationFeature*>(eachOperation);
156 FeaturePtr aFeature = aFOperation->feature();
158 result << QString::fromStdString(aFeature->getKind());
165 ModuleBase_Operation* XGUI_OperationMgr::previousOperation(ModuleBase_Operation* theOperation) const
167 int idx = myOperations.lastIndexOf(theOperation);
168 if(idx == -1 || idx == 0) {
171 return myOperations.at(idx - 1);
174 bool XGUI_OperationMgr::eventFilter(QObject *theObject, QEvent *theEvent)
176 bool isAccepted = false;
177 if (theEvent->type() == QEvent::KeyRelease) {
178 QKeyEvent* aKeyEvent = dynamic_cast<QKeyEvent*>(theEvent);
180 isAccepted = onKeyReleased(theObject, aKeyEvent);
183 isAccepted = QObject::eventFilter(theObject, theEvent);
188 bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation)
191 currentOperation()->postpone();
192 myOperations.append(theOperation);
194 connect(theOperation, SIGNAL(beforeStarted()), SLOT(onBeforeOperationStarted()));
195 connect(theOperation, SIGNAL(beforeAborted()), SLOT(onBeforeOperationAborted()));
196 connect(theOperation, SIGNAL(beforeCommitted()), SLOT(onBeforeOperationCommitted()));
198 connect(theOperation, SIGNAL(started()), SLOT(onOperationStarted()));
199 connect(theOperation, SIGNAL(aborted()), SLOT(onOperationAborted()));
200 connect(theOperation, SIGNAL(committed()), SLOT(onOperationCommitted()));
202 connect(theOperation, SIGNAL(stopped()), SLOT(onOperationStopped()));
203 connect(theOperation, SIGNAL(resumed()), SLOT(onOperationResumed()));
205 bool isStarted = theOperation->start();
207 onValidateOperation();
211 void XGUI_OperationMgr::onAbortAllOperations()
213 abortAllOperations();
216 bool XGUI_OperationMgr::abortAllOperations(const XGUI_MessageKind& theMessageKind)
222 if (operationsCount() == 1) {
223 ModuleBase_Operation* aCurrentOperation = currentOperation();
224 if (canStopOperation(aCurrentOperation, theMessageKind)) {
225 abortOperation(aCurrentOperation);
231 if (theMessageKind == XGUI_AbortOperationMessage) {
232 aResult = QMessageBox::question(qApp->activeWindow(),
233 tr("Abort operation"),
234 tr("All active operations will be aborted."),
235 QMessageBox::Ok | QMessageBox::Cancel,
236 QMessageBox::Cancel) == QMessageBox::Ok;
238 else if (theMessageKind == XGUI_InformationMessage) {
239 QString aMessage = tr("Please validate all your active operations before saving.");
240 QMessageBox::question(qApp->activeWindow(),
241 tr("Validate operation"),
245 aResult = false; // do not perform abort
247 while(aResult && hasOperation()) {
248 abortOperation(currentOperation());
254 bool XGUI_OperationMgr::commitAllOperations()
256 bool isCompositeCommitted = false, anOperationProcessed = false;
257 while (hasOperation()) {
258 ModuleBase_Operation* anOperation = currentOperation();
259 if (XGUI_Tools::workshop(myWorkshop)->errorMgr()->isApplyEnabled()) {
260 anOperationProcessed = commitOperation();
262 abortOperation(anOperation);
263 anOperationProcessed = true;
265 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
268 FeaturePtr aFeature = aFOperation->feature();
269 CompositeFeaturePtr aComposite =
270 std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature);
271 isCompositeCommitted = aComposite.get();
272 if (isCompositeCommitted)
275 // not processed[committed] operation might be used in composite feature,
276 // so the while will be stopped by the previous check.
277 // this code is not necessary, but logically should be done when the processing will not
278 // be done for not composite feature by some reasons
279 if (!anOperationProcessed)
285 void XGUI_OperationMgr::onValidateOperation()
289 ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
290 (currentOperation());
291 if(aFOperation && aFOperation->feature().get())
292 XGUI_Tools::workshop(myWorkshop)->errorMgr()->updateActions(aFOperation->feature());
295 void XGUI_OperationMgr::updateApplyOfOperations(ModuleBase_Operation* theOperation)
297 XGUI_ErrorMgr* anErrorMgr = XGUI_Tools::workshop(myWorkshop)->errorMgr();
299 ModuleBase_OperationFeature* aFOperation =
300 dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
302 anErrorMgr->updateAcceptAllAction(aFOperation->feature());
305 foreach(ModuleBase_Operation* anOperation, myOperations) {
307 updateApplyOfOperations(anOperation);
310 // Apply button of the current operation should also be updated
311 onValidateOperation();
314 bool XGUI_OperationMgr::canStopOperation(ModuleBase_Operation* theOperation,
315 const XGUI_OperationMgr::XGUI_MessageKind& theMessageKind)
317 //in case of nested (sketch) operation no confirmation needed
318 if (isGrantedOperation(theOperation->id()))
320 if (theOperation && theOperation->isModified()) {
321 if (theMessageKind == XGUI_AbortOperationMessage) {
322 QString aMessage = tr("%1 operation will be aborted.").arg(theOperation->id());
323 int anAnswer = QMessageBox::question(qApp->activeWindow(),
324 tr("Abort operation"),
326 QMessageBox::Ok | QMessageBox::Cancel,
327 QMessageBox::Cancel);
328 return anAnswer == QMessageBox::Ok;
330 else if (theMessageKind == XGUI_InformationMessage) {
331 QString aMessage = tr("Please validate your %1 before saving.").arg(theOperation->id());
332 QMessageBox::question(qApp->activeWindow(),
333 tr("Validate operation"),
343 void XGUI_OperationMgr::resumeOperation(ModuleBase_Operation* theOperation)
345 theOperation->resume();
348 bool XGUI_OperationMgr::isGrantedOperation(const QString& theId)
350 bool isGranted = false;
352 QListIterator<ModuleBase_Operation*> anIt(myOperations);
354 ModuleBase_Operation* aPreviousOperation = 0;
355 while (anIt.hasPrevious() && !isGranted) {
356 ModuleBase_Operation* anOp = anIt.previous();
358 isGranted = anOp->isGranted(theId);
363 void XGUI_OperationMgr::setCurrentFeature(const FeaturePtr& theFeature)
365 SessionPtr aMgr = ModelAPI_Session::get();
366 DocumentPtr aDoc = aMgr->activeDocument();
367 bool aIsOp = aMgr->isOperation();
369 aMgr->startOperation(QString("Set current feature: %1")
370 .arg(theFeature->getKind().c_str()).toStdString());
371 aDoc->setCurrentFeature(theFeature, false);
373 aMgr->finishOperation();
376 bool XGUI_OperationMgr::canStartOperation(const QString& theId, bool& isCommitted)
378 bool aCanStart = true;
380 ModuleBase_Operation* aCurrentOp = currentOperation();
382 bool aGranted = aCurrentOp->isGranted(theId);
383 // the started operation is granted for the current one,
384 // e.g. current - Sketch, started - Line
389 if (!isGrantedOperation(theId)) {
390 // the operation is not granted in the current list of operations
391 // e.g. Edit Parameter when Sketch, Line in Sketch is active.
392 aCanStart = abortAllOperations();
394 else if (canStopOperation(aCurrentOp)) {
395 // the started operation is granted in the parrent operation,
396 // e.g. current - Line in Sketch, started Circle
397 stopOperation(aCurrentOp, isCommitted);
406 void XGUI_OperationMgr::stopOperation(ModuleBase_Operation* theOperation, bool& isCommitted)
408 if (XGUI_Tools::workshop(myWorkshop)->errorMgr()->isApplyEnabled() && theOperation->isModified())
409 isCommitted = theOperation->commit();
412 abortOperation(theOperation);
416 void XGUI_OperationMgr::abortOperation(ModuleBase_Operation* theOperation)
418 ModuleBase_Operation* aCurrentOperation = currentOperation();
419 if (theOperation == aCurrentOperation)
420 theOperation->abort();
422 // it is possible to trigger upper operation(e.g. sketch, current is sketch line)
423 // all operation from the current to triggered should also be aborted
424 // operations over the parameter one are not aborted(e.g. extrusion cut, sketch abort)
425 while(hasOperation()) {
426 ModuleBase_Operation* aCurrentOperation = currentOperation();
427 aCurrentOperation->abort();
428 if(theOperation == aCurrentOperation)
434 bool XGUI_OperationMgr::commitOperation()
436 bool isCommitted = false;
437 ModuleBase_Operation* anOperation = currentOperation();
438 if (anOperation && myWorkshop->module()->canCommitOperation())
439 isCommitted = anOperation->commit();
443 void XGUI_OperationMgr::onAbortOperation()
445 ModuleBase_Operation* aCurrentOperation = currentOperation();
446 if (aCurrentOperation && canStopOperation(aCurrentOperation)) {
447 abortOperation(aCurrentOperation);
451 void XGUI_OperationMgr::onBeforeOperationStarted()
453 ModuleBase_Operation* aCurrentOperation = dynamic_cast<ModuleBase_Operation*>(sender());
454 if (!aCurrentOperation)
457 /// Set current feature and remeber old current feature
458 ModuleBase_OperationFeature* aFOperation =
459 dynamic_cast<ModuleBase_OperationFeature*>(aCurrentOperation);
461 SessionPtr aMgr = ModelAPI_Session::get();
462 DocumentPtr aDoc = aMgr->activeDocument();
463 // the parameter of current feature should be false, we should use all feature, not only
464 // visible in order to correctly save the previous feature of the nested operation, where the
465 // features can be not visible in the tree. The problem case is Edit sketch entitity(line)
466 // in the Sketch, created in ExtrusionCut operation. The entity disappears by commit.
467 // When sketch entity operation started, the sketch should be cashed here as the current.
468 // Otherwise(the flag is true), the ExtrusionCut is cashed, when commit happens, the sketch
469 // is disabled, sketch entity is disabled as extrusion cut is created earliest then sketch.
470 // As a result the sketch disappears from the viewer.
471 // However after commit it is displayed back.
472 aFOperation->setPreviousCurrentFeature(aDoc->currentFeature(false));
474 #ifdef DEBUG_CURRENT_FEATURE
475 FeaturePtr aFeature = aFOperation->feature();
476 QString aKind = aFeature ? aFeature->getKind().c_str() : "";
477 qDebug(QString("onBeforeOperationStarted(), edit operation = %1, feature = %2")
478 .arg(aFOperation->isEditOperation())
479 .arg(ModuleBase_Tools::objectInfo(aFeature)).toStdString().c_str());
481 qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
482 ModuleBase_Tools::objectInfo(
483 ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
484 .toStdString().c_str());
487 if (aFOperation->isEditOperation()) {// it should be performed by the feature edit only
488 // in create operation, the current feature is changed by addFeature()
489 aDoc->setCurrentFeature(aFOperation->feature(), false);
490 // this is the only place where flushes must be called after setCurrentFeature for the
491 // current moment: after this the opertion is not finished, so, the ObjectBrowser
492 // state may be corrupted (issue #1457)
493 static Events_Loop* aLoop = Events_Loop::loop();
494 static Events_ID aCreateEvent = aLoop->eventByName(EVENT_OBJECT_CREATED);
495 aLoop->flush(aCreateEvent);
496 static Events_ID aDeleteEvent = aLoop->eventByName(EVENT_OBJECT_DELETED);
497 aLoop->flush(aDeleteEvent);
500 #ifdef DEBUG_CURRENT_FEATURE
501 qDebug("\tdocument->setCurrentFeature");
502 qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
503 ModuleBase_Tools::objectInfo(
504 ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
505 .toStdString().c_str());
510 void XGUI_OperationMgr::onOperationStarted()
512 ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
513 updateApplyOfOperations(aSenderOperation);
514 XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
515 aWorkshop->operationStarted(aSenderOperation);
518 void XGUI_OperationMgr::onBeforeOperationAborted()
520 onBeforeOperationCommitted();
523 void XGUI_OperationMgr::onOperationAborted()
525 ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
526 emit operationAborted(aSenderOperation);
529 void XGUI_OperationMgr::onBeforeOperationCommitted()
531 ModuleBase_Operation* aCurrentOperation = dynamic_cast<ModuleBase_Operation*>(sender());
532 if (!aCurrentOperation)
535 /// Restore the previous current feature
536 ModuleBase_OperationFeature* aFOperation =
537 dynamic_cast<ModuleBase_OperationFeature*>(aCurrentOperation);
539 #ifdef DEBUG_CURRENT_FEATURE
540 QString aKind = aFOperation->feature()->getKind().c_str();
541 qDebug(QString("onBeforeOperationCommitted(), edit operation = %1, feature = %2")
542 .arg(aFOperation->isEditOperation())
543 .arg(ModuleBase_Tools::objectInfo(aFOperation->feature())).toStdString().c_str());
545 qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
546 ModuleBase_Tools::objectInfo(
547 ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
548 .toStdString().c_str());
551 if (aFOperation->isEditOperation()) {
552 /// Restore the previous current feature
553 setCurrentFeature(aFOperation->previousCurrentFeature());
555 else { // create operation
556 // the Top created feature should stays the current. In nested operations,
557 // like Line in the Sketch or
558 // Sketch in ExtrusionCut, a previous feature should be restored on commit.
559 // It is performed here
560 // in order to perform it in the current transaction without opening a new one.
561 if (myOperations.front() != aFOperation)
562 setCurrentFeature(aFOperation->previousCurrentFeature());
564 #ifdef DEBUG_CURRENT_FEATURE
565 qDebug("\tdocument->setCurrentFeature");
566 qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
567 ModuleBase_Tools::objectInfo(
568 ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
569 .toStdString().c_str());
571 ModuleBase_IModule* aModule = myWorkshop->module();
573 aModule->beforeOperationStopped(aFOperation);
577 void XGUI_OperationMgr::onOperationCommitted()
579 // apply state for all features from the stack of operations should be updated
580 updateApplyOfOperations();
582 ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
583 emit operationCommitted(aSenderOperation);
586 void XGUI_OperationMgr::onOperationResumed()
588 ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
589 emit operationResumed(aSenderOperation);
592 void XGUI_OperationMgr::onOperationStopped()
594 ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
595 ModuleBase_Operation* aCurrentOperation = currentOperation();
596 if (!aSenderOperation || !aCurrentOperation || aSenderOperation != aCurrentOperation)
599 myOperations.removeAll(aCurrentOperation);
600 aCurrentOperation->deleteLater();
602 emit operationStopped(aCurrentOperation);
604 // get last operation which can be resumed
605 ModuleBase_Operation* aResultOp = 0;
606 QListIterator<ModuleBase_Operation*> anIt(myOperations);
608 while (anIt.hasPrevious()) {
609 ModuleBase_Operation* anOp = anIt.previous();
616 bool isModified = aCurrentOperation->isModified();
617 aResultOp->setIsModified(aResultOp->isModified() || isModified);
618 resumeOperation(aResultOp);
619 onValidateOperation();
623 bool XGUI_OperationMgr::onKeyReleased(QObject *theObject, QKeyEvent* theEvent)
625 // Let the manager decide what to do with the given key combination.
626 ModuleBase_Operation* anOperation = currentOperation();
627 bool isAccepted = false;
628 switch (theEvent->key()) {
630 case Qt::Key_Enter: {
631 isAccepted = onProcessEnter(theObject);
636 bool noModifiers = (theEvent->modifiers() == Qt::NoModifier);
638 ModuleBase_IViewer* aViewer = myWorkshop->viewer();
639 Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
640 if (!aContext.IsNull()) {
641 Handle(V3d_View) aView = aViewer->activeView();
642 if ((theEvent->key() == Qt::Key_N))
643 aContext->HilightNextDetected(aView);
644 else if ((theEvent->key() == Qt::Key_P))
645 aContext->HilightPreviousDetected(aView);
656 // anOperation->keyReleased(theEvent->key());
661 bool XGUI_OperationMgr::onProcessEnter(QObject* theObject)
663 bool isAccepted = false;
664 ModuleBase_Operation* aOperation = currentOperation();
665 // to avoid enter processing when operation has not been started yet
668 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
669 // only property panel enter is processed in order to do not process enter in application dialogs
670 bool isPPChild = isChildObject(theObject, aPanel);
674 ModuleBase_ModelWidget* anActiveWgt = aPanel->activeWidget();
675 bool isAborted = false;
677 QWidget* aFocusWidget = aPanel->focusWidget();
678 QToolButton* aCancelBtn =
679 dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_CANCEL);
680 if (aFocusWidget && aCancelBtn && aFocusWidget == aCancelBtn) {
681 abortOperation(aOperation);
687 isAccepted = anActiveWgt && anActiveWgt->processEnter();
690 myWorkshop->module()->processEnter(anActiveWgt ? anActiveWgt->attributeID() : "");
692 /// functionality is similar to Apply click
693 ModuleBase_OperationFeature* aFOperation =
694 dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
696 myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) {
697 // key released is emitted to apply the current value to the model
698 // if it was modified in PP
699 emit keyEnterReleased();
711 bool editorControl(QObject* theObject)
713 QLineEdit* aLineEdit = dynamic_cast<QLineEdit*>(theObject);
717 bool XGUI_OperationMgr::onProcessDelete(QObject* theObject)
719 bool isAccepted = false;
720 ModuleBase_Operation* aOperation = currentOperation();
721 ModuleBase_ModelWidget* anActiveWgt = 0;
722 // firstly the widget should process Delete action
723 ModuleBase_IPropertyPanel* aPanel;
724 bool isPPChildObject = false;
726 aPanel = aOperation->propertyPanel();
728 isPPChildObject = isChildObject(theObject, aPanel);
729 // process delete in active widget only if delete sender is child of property panel
730 // it is necessary for the case when OB is shown, user perform selection and click Delete
731 if (isPPChildObject) {
732 anActiveWgt = aPanel->activeWidget();
734 isAccepted = anActiveWgt->processDelete();
740 // after widget, object browser and viewer should process delete
741 /// other widgets such as line edit controls should not lead to
742 /// processing delete by workshop
743 XGUI_ObjectsBrowser* aBrowser = XGUI_Tools::workshop(myWorkshop)->objectBrowser();
744 QWidget* aViewPort = myWorkshop->viewer()->activeViewPort();
745 bool isToDeleteObject = false;
746 XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
747 XGUI_ContextMenuMgr* aContextMenuMgr = aWorkshop->contextMenuMgr();
748 if (theObject == aBrowser->treeView()) {
749 aContextMenuMgr->updateObjectBrowserMenu();
750 isToDeleteObject = aContextMenuMgr->action("DELETE_CMD")->isEnabled();
752 else if (isChildObject(theObject, aViewPort)) {
753 aContextMenuMgr->updateViewerMenu();
754 isToDeleteObject = aContextMenuMgr->action("DELETE_CMD")->isEnabled();
756 else if (isPPChildObject) {
757 // property panel child object is processed to process delete performed on Apply button of PP
758 isToDeleteObject = true;
760 else if (editorControl(theObject)) {
761 isToDeleteObject = false; /// Line Edit of Rename operation in ObjectBrowser
765 if (isToDeleteObject) {
766 aWorkshop->deleteObjects();
774 bool XGUI_OperationMgr::isChildObject(const QObject* theObject, const QObject* theParent)
776 bool isPPChild = false;
777 if (theParent && theObject) {
778 QObject* aParent = (QObject*)theObject;
780 isPPChild = aParent == theParent;
783 aParent = aParent->parent();