void PartSet_OperationFeatureBase::onWidgetActivated(ModuleBase_ModelWidget* theWidget)
{
myActiveWidget = theWidget;
+ activateByPreselection();
+ if (myInitFeature && myActiveWidget) {
+ ModuleBase_WidgetPoint2D* aWgt = dynamic_cast<ModuleBase_WidgetPoint2D*>(myActiveWidget);
+ if (aWgt && aWgt->initFromPrevious(myInitFeature)) {
+ myInitFeature = FeaturePtr();
+ emit activateNextWidget(myActiveWidget);
+ }
+ }
+}
+
+void PartSet_OperationFeatureBase::activateByPreselection()
+{
if ((myPreSelection.size() > 0) && myActiveWidget) {
const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
ModuleBase_WidgetValueFeature aValue;
aValue.setObject(aPrs.object());
if (myActiveWidget->setValue(&aValue)) {
myPreSelection.remove(aPrs);
- emit activateNextWidget(myActiveWidget);
- }
- }
- if (myInitFeature && myActiveWidget) {
- ModuleBase_WidgetPoint2D* aWgt = dynamic_cast<ModuleBase_WidgetPoint2D*>(myActiveWidget);
- if (aWgt && aWgt->initFromPrevious(myInitFeature)) {
- myInitFeature = FeaturePtr();
- emit activateNextWidget(myActiveWidget);
+ if(isValid()) {
+ myActiveWidget = NULL;
+ commit();
+ } else {
+ emit activateNextWidget(myActiveWidget);
+ }
}
+ // If preselection is enough to make a valid feature - apply it immediately
}
}