#include <ModelAPI_Events.h>
#include <ModelAPI_AttributeSelectionList.h>
+#include <ModuleBase_Operation.h>
+#include <ModuleBase_OperationFeature.h>
+#include <XGUI_OperationMgr.h>
+
#include <QAction>
#include <QCheckBox>
#include <QFocusEvent>
// the selection is cleared by activating selection control
myWorkshop->selector()->clearSelection();
}
- else
+ else{
emit deactivated();
+ myUndoList.clear();
+ }
}
//********************************************************************
myItems.insert(myLastItemIndex, aPrs);
myListView->addItem(aItemName, myLastItemIndex);
+ // add in undo list
+ myUndoList.push_back(myLastItemIndex);
myLastItemIndex++;
isModified = true;
}
bool XGUI_FacesPanel::processDelete()
{
//appendFirstSelectionInHistory();
- QModelIndexList anIndices = myListView->getControl()->selectionModel()->selectedIndexes();
+ //QModelIndexList anIndices = myListView->getControl()->selectionModel()->selectedIndexes();
std::set<int> aSelectedIds;
myListView->getSelectedIndices(aSelectedIds);
reset(true);
}
+//********************************************************************
+
+void XGUI_FacesPanel::processUndo()
+{
+ if(!myUndoList.size())
+ return;
+
+ myListView->selectIndices({myUndoList.back()});
+ processDelete();
+ myUndoList.pop_back();
+}
+
//********************************************************************
void XGUI_FacesPanel::flushRedisplay() const
{
/// \return whether the delete action is processed
bool processDelete();
+ /// Delete last(s) item(s) added since the recent activation of the faces panel
+ void processUndo();
+
/// Processing focus in/out for the faces control
/// \param theObject source object of event
/// \param theEvent an event
bool myIsActive; ///< current state about the panel is active
int myLastItemIndex; ///< last index to be used in the map of items for the next added item
+ std::vector<int> myUndoList; ///< indexes of items for undo
QMap<int, ModuleBase_ViewerPrsPtr> myItems; ///< selected face items
std::set<ObjectPtr > myItemObjects; ///< cached objects of myItems
std::set<ObjectPtr > myHiddenGroups; ///< hidden objects
};
-#endif
\ No newline at end of file
+#endif
if (anActiveWidget->processAction(theActionType, aParam))
return;
}
+ else
+ {
+ XGUI_FacesPanel * anFacePannel = facesPanel();
+ if(ActionUndo == theActionType && anFacePannel->isActivePanel())
+ {
+ anFacePannel->processUndo();
+ return;
+ }
+ }
// the viewer update should be blocked in order to avoid the features blinking. For the created
// feature a results are created, the flush of the created signal caused the viewer redisplay for
// each created result. After a redisplay signal is flushed. So, the viewer update is blocked
aMgr->finishOperation();
updateCommandStatus();
}
-}
\ No newline at end of file
+}