const Config_WidgetAPI* theData,
const std::string& theParentId)
: ModuleBase_WidgetValidated(theParent, theData, theParentId),
- myWorkshop(theWorkshop), myIsActive(false)
+ myWorkshop(theWorkshop)
{
QGridLayout* aMainLay = new QGridLayout(this);
ModuleBase_Tools::adjustMargins(aMainLay);
ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector()
{
- myIsActive = false;
- activateShapeSelection();
+ activateShapeSelection(false);
}
//********************************************************************
this, SLOT(onSelectionChanged()),
Qt::UniqueConnection);
- myIsActive = true;
- activateShapeSelection();
+ activateShapeSelection(true);
QObjectPtrList anObjects;
// Restore selection in the viewer by the attribute selection list
void ModuleBase_WidgetMultiSelector::deactivate()
{
disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
- myIsActive = false;
- activateShapeSelection();
+ activateShapeSelection(false);
}
//********************************************************************
//********************************************************************
void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
{
- activateShapeSelection();
+ activateShapeSelection(true);
QObjectPtrList anEmptyList;
// This method will call Selection changed event which will call onSelectionChanged
// To clear mySelection, myListControl and storeValue()
aShapeTypeName = myTypeCombo->itemText(idx);
TopAbs_ShapeEnum aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
- myIsActive = false;
- activateShapeSelection();
+ activateShapeSelection(false);
bool isBlocked = myTypeCombo->blockSignals(true);
myTypeCombo->setCurrentIndex(idx);
- myIsActive = true;
myTypeCombo->blockSignals(isBlocked);
- activateShapeSelection();
+ activateShapeSelection(true);
break;
}
}
}
-void ModuleBase_WidgetMultiSelector::activateShapeSelection()
+void ModuleBase_WidgetMultiSelector::activateShapeSelection(const bool isActivated)
{
ModuleBase_IViewer* aViewer = myWorkshop->viewer();
- if (myIsActive) {
+ if (isActivated) {
QString aNewType = myTypeCombo->currentText();
QIntList aList;
aList.append(ModuleBase_Tools::shapeType(aNewType));
myWorkshop->deactivateSubShapesSelection();
}
- activateFilters(myWorkshop, myIsActive);
+ activateFilters(myWorkshop, isActivated);
}
//********************************************************************
void setCurrentShapeType(const TopAbs_ShapeEnum theShapeType);
/// Start shape selection
- void activateShapeSelection();
+ /// \param isActivated a state whether the shape is activated or deactivated in selection
+ void activateShapeSelection(const bool isActivated);
protected:
/// Update selection list
//TODO: Move into the base of selectors
ModuleBase_IWorkshop* myWorkshop;
- /// If true then local selector has to be activated in context
- bool myIsActive;
-
/// Provides correspondance between Result object and its shape
typedef QPair<ResultPtr, GeomShapePtr> GeomSelection;