-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "XGUI_Tools.h"
#include "XGUI_ObjectsBrowser.h"
#include "XGUI_ContextMenuMgr.h"
+#include "XGUI_Selection.h"
+#include "XGUI_SelectionMgr.h"
#include <ModuleBase_IPropertyPanel.h>
#include <ModuleBase_ModelWidget.h>
isAccepted = myOperationMgr->onProcessDelete(theObject);
break;
case Qt::Key_F2:
- myOperationMgr->xworkshop()->objectBrowser()->onEditItem();
+ {
+ QObjectPtrList anObjects = myOperationMgr->xworkshop()->selector()->selection()->selectedObjects();
+ if (myOperationMgr->xworkshop()->abortAllOperations())
+ {
+ myOperationMgr->xworkshop()->objectBrowser()->setObjectsSelected(anObjects);
+ myOperationMgr->xworkshop()->objectBrowser()->onEditItem();
+ }
isAccepted = true;
break;
+ }
default:
isAccepted = myOperationMgr->onKeyReleased(theObject, aKeyEvent);
break;
XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent,
ModuleBase_IWorkshop* theWorkshop)
-: QObject(theParent), myWorkshop(theWorkshop), mySHIFTPressed(false), myActiveMessageBox(0)
+: QObject(theParent), myWorkshop(theWorkshop), myActiveMessageBox(0), mySHIFTPressed(false)
{
/// 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
if (theOperation && theOperation->isModified()) {
ModuleBase_OperationFeature* aOp = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
std::string aContext;
- if (aOp)
+ if (aOp && aOp->feature())
aContext = aOp->feature()->getKind();
QString aTitle = Config_Translator::translate(aContext,
theOperation->getDescription()->description().toStdString()).c_str();
QListIterator<ModuleBase_Operation*> anIt(myOperations);
anIt.toBack();
- ModuleBase_Operation* aPreviousOperation = 0;
while (anIt.hasPrevious() && !isGranted) {
ModuleBase_Operation* anOp = anIt.previous();
if (anOp)
// all operation from the current to triggered should also be aborted
// operations over the parameter one are not aborted(e.g. extrusion cut, sketch abort)
while(hasOperation()) {
- ModuleBase_Operation* aCurrentOperation = currentOperation();
- aCurrentOperation->abort();
- if(theOperation == aCurrentOperation)
+ ModuleBase_Operation* aCurOperation = currentOperation();
+ aCurOperation->abort();
+ if(theOperation == aCurOperation)
break;
}
}
bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent* theEvent)
{
// Let the manager decide what to do with the given key combination.
- ModuleBase_Operation* anOperation = currentOperation();
bool isAccepted = false;
switch (theEvent->key()) {
case Qt::Key_Escape: {