From d0b2ae5db5c29548672a1eeac03f713b69aefc96 Mon Sep 17 00:00:00 2001 From: sbh Date: Fri, 31 Oct 2014 18:41:16 +0300 Subject: [PATCH] Issue #220: proper work for multiselection widget on shape type changing. --- .../ModuleBase_WidgetMultiSelector.cpp | 18 ++++++++++++------ .../ModuleBase_WidgetMultiSelector.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 227ec1586..84b0feb65 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -79,7 +79,7 @@ bool ModuleBase_WidgetMultiSelector::storeValue() const AttributeSelectionListPtr aSelectionListAttr = boost::dynamic_pointer_cast(aData->attribute(attributeID())); - if (aSelectionListAttr && (mySelection.size() > 0)) { + if (aSelectionListAttr) { aSelectionListAttr->clear(); // Store shapes type TopAbs_ShapeEnum aCurrentType = @@ -165,7 +165,6 @@ void ModuleBase_WidgetMultiSelector::onSelectionChanged() mySelection.append(GeomSelection(aResult, aShape)); } updateSelectionList(); - storeValue(); emit valuesChanged(); } @@ -232,19 +231,26 @@ void ModuleBase_WidgetMultiSelector::activateSelection(bool toActivate) myIsActive = toActivate; if (myIsActive) { connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); - onSelectionTypeChanged(); + //onSelectionTypeChanged(); } else { disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); myWorkshop->deactivateSubShapesSelection(); } } -//******************************************************************** -void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged() +void ModuleBase_WidgetMultiSelector::activateShapeSelection() { - myListControl->clear(); QString aNewType = myTypeCombo->currentText(); QIntList aList; aList.append(ModuleBase_WidgetShapeSelector::shapeType(aNewType)); myWorkshop->activateSubShapesSelection(aList); } + +//******************************************************************** +void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged() +{ + QList anEmptyList; + myWorkshop->setSelected(anEmptyList); + activateShapeSelection(); + onSelectionChanged(); +} diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index a456a10dc..f94a19e2f 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -62,6 +62,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Model void filterShapes(const NCollection_List& theShapesToFilter, NCollection_List& theResult); void setCurrentShapeType(const TopAbs_ShapeEnum theShapeType); + void activateShapeSelection(); private: void updateSelectionList(); -- 2.39.2