}
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
- if (!aFOperation || aFOperation->isEditOperation())
+ if (!aFOperation)
return;
// the selection is cleared after commit the create operation
// in order to do not use the same selected objects in the restarted operation
myRestartingMode == RM_EmptyFeatureUsed)) {
myLastOperationId = aFOperation->id();
myLastFeature = myRestartingMode == RM_LastFeatureUsed ? aFOperation->feature() : FeaturePtr();
- if (!sketchMgr()->sketchSolverError())
- launchOperation(myLastOperationId);
+ if (!sketchMgr()->sketchSolverError()) {
+ if (!aFOperation->isEditOperation()) {
+ FeaturePtr anOperationFeature = aFOperation->feature();
+ if (anOperationFeature.get() != NULL) {
+ editFeature(anOperationFeature);
+ // 4. activate the first obligatory widget
+ if (!myPreviousAttributeID.empty()) {
+ ModuleBase_Operation* anEditOperation = currentOperation();
+ if (anEditOperation) {
+ ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
+ ModuleBase_ModelWidget* aPreviousAttributeWidget = 0;
+ QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
+ for (int i = 0, aNb = aWidgets.size(); i < aNb && !aPreviousAttributeWidget; i++) {
+ if (aWidgets[i]->attributeID() == myPreviousAttributeID)
+ aPreviousAttributeWidget = aWidgets[i];
+ }
+ if (aPreviousAttributeWidget)
+ aPreviousAttributeWidget->focusTo();
+ }
+ }
+ }
+ }
+ else {
+ launchOperation(myLastOperationId);
+ breakOperationSequence();
+ }
+ }
}
- breakOperationSequence();
}
void PartSet_Module::breakOperationSequence()
void PartSet_Module::onEnterReleased()
{
- myRestartingMode = RM_EmptyFeatureUsed;
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (currentOperation());
+ if (!aFOperation->isEditOperation())
+ myRestartingMode = RM_EmptyFeatureUsed;
}
void PartSet_Module::onOperationActivatedByPreselection()
}
}
-void PartSet_Module::onNoMoreWidgets()
+void PartSet_Module::onNoMoreWidgets(const std::string& thePreviousAttributeID)
{
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
if (anOperation) {
if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
- if (myRestartingMode != RM_Forbided)
+ if (myRestartingMode != RM_Forbided) {
myRestartingMode = RM_LastFeatureUsed;
+ myPreviousAttributeID = thePreviousAttributeID;
+ }
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
XGUI_Workshop* aWorkshop = aConnector->workshop();
XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
public slots:
/// SLOT, that is called by no more widget signal emitted by property panel
/// Set a specific flag to restart the sketcher operation
- void onNoMoreWidgets();
+ void onNoMoreWidgets(const std::string& thePreviousAttributeID);
/// Redefines the parent method in order to customize the next case:
/// If the sketch nested operation is active and the presentation is not visualized in the viewer,
QString myLastOperationId;
FeaturePtr myLastFeature;
+ std::string myPreviousAttributeID;
+
// Automatical restarting mode flag
RestartingMode myRestartingMode;
QAction* aCancelAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Abort);
connect(aCancelAct, SIGNAL(triggered()), myOperationMgr, SLOT(onAbortOperation()));
- connect(myPropertyPanel, SIGNAL(noMoreWidgets()), myModule, SLOT(onNoMoreWidgets()));
+ connect(myPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)),
+ myModule, SLOT(onNoMoreWidgets(const std::string&)));
connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)),
myOperationMgr, SLOT(onKeyReleased(QKeyEvent*)));
//connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),