/// The operation is postponed
void postponed();
+ /// The operation is triggered
+ /// \param theState a new triggered state
+ void triggered(bool theState);
+
/// The operation is filled with existing preselection
void activatedByPreselection();
connect(theOperation, SIGNAL(committed()), SLOT(onOperationCommitted()));
connect(theOperation, SIGNAL(stopped()), SLOT(onOperationStopped()));
connect(theOperation, SIGNAL(resumed()), SLOT(onOperationResumed()));
+ connect(theOperation, SIGNAL(triggered(bool)), SLOT(onOperationTriggered(bool)));
connect(theOperation, SIGNAL(activatedByPreselection()),
SIGNAL(operationActivatedByPreselection()));
}
}
+void XGUI_OperationMgr::onOperationTriggered(bool theState)
+{
+ ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
+ if (aSenderOperation && !theState) {
+ ModuleBase_Operation* aCurrentOperation = currentOperation();
+ if (aSenderOperation == aCurrentOperation)
+ aCurrentOperation->abort();
+ else {
+ // it is possible to trigger upper operation(e.g. sketch, current is sketch line)
+ // all operation from the current to triggered should also be aborted
+ while(hasOperation()) {
+ ModuleBase_Operation* aCurrentOperation = currentOperation();
+ aCurrentOperation->abort();
+ if(aSenderOperation == aCurrentOperation)
+ break;
+ }
+ }
+ }
+}
+
bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
{
// Let the manager decide what to do with the given key combination.
/// Slot called on operation resume
void onOperationResumed();
+ /// Slot called on operation triggered
+ void onOperationTriggered(bool theState);
+
private:
typedef QList<ModuleBase_Operation*> Operations; ///< definition for a list of operations
Operations myOperations; ///< a stack of started operations. The active operation is on top,