aShapeTypeName = myTypeCombo->itemText(idx);
TopAbs_ShapeEnum aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
- activateSelectionAndFilters(false);
+ bool aWasActivated = activateSelectionAndFilters(false);
bool isBlocked = myTypeCombo->blockSignals(true);
myTypeCombo->setCurrentIndex(idx);
myTypeCombo->blockSignals(isBlocked);
-
- activateSelectionAndFilters(true);
+ if (aWasActivated)
+ activateSelectionAndFilters(true);
break;
}
}
}
//********************************************************************
-void ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate)
+bool ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate)
{
updateSelectionName();
} else {
myWorkshop->deactivateSubShapesSelection();
}
- activateFilters(toActivate);
+ return activateFilters(toActivate);
}
//********************************************************************
virtual bool isViewerSelector() { return true; }
/// Activate or deactivate selection and selection filters
- virtual void activateSelectionAndFilters(bool toActivate);
+ /// \return true if the selection filter of the widget is activated in viewer context
+ virtual bool activateSelectionAndFilters(bool toActivate);
/// Checks the widget validity. By default, it returns true.
/// \param thePrs a selected presentation in the view
return aViewer->hasSelectionFilter(aSelFilter);
}
-void ModuleBase_WidgetValidated::activateFilters(const bool toActivate)
+bool ModuleBase_WidgetValidated::activateFilters(const bool toActivate)
{
ModuleBase_IViewer* aViewer = myWorkshop->viewer();
Handle(SelectMgr_Filter) aSelFilter = myWorkshop->validatorFilter();
+ bool aHasSelectionFilter = aViewer->hasSelectionFilter(aSelFilter);
+
if (toActivate)
aViewer->addSelectionFilter(aSelFilter);
else {
aViewer->removeSelectionFilter(aSelFilter);
clearValidState();
}
+
+ return aHasSelectionFilter;
}
//********************************************************************
/// It obtains selection filters from the workshop and activates them in the active viewer
/// \param toActivate a flag about activation or deactivation the filters
- void activateFilters(const bool toActivate);
+ /// \return true if the selection filter of the widget is activated in viewer context
+ bool activateFilters(const bool toActivate);
/// Block the model flush of update and intialization of attribute
/// \param theToBlock flag whether the model is blocked or unblocked
}
//********************************************************************
-void PartSet_WidgetShapeSelector::activateSelectionAndFilters(bool toActivate)
+bool PartSet_WidgetShapeSelector::activateSelectionAndFilters(bool toActivate)
{
- ModuleBase_WidgetShapeSelector::activateSelectionAndFilters(toActivate);
+ bool aHasSelectionFilter = ModuleBase_WidgetShapeSelector::activateSelectionAndFilters
+ (toActivate);
if (!myUseSketchPlane) {
XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(aWorkshop->module());
bool isUsePlaneFilterOnly = !toActivate;
aModule->sketchMgr()->activatePlaneFilter(isUsePlaneFilterOnly);
}
+ return aHasSelectionFilter;
}
//********************************************************************
/// Activate or deactivate selection and selection filters
/// \param toActivate boolean state whether it should be activated/deactivated
- virtual void activateSelectionAndFilters(bool toActivate);
+ virtual bool activateSelectionAndFilters(bool toActivate);
protected:
/// Checks the widget validity. By default, it returns true.