X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_WidgetSelector.cpp;h=11811c4220061e53355709ed179bf44471f4fd49;hb=2cade87faaf69a42f5f4d5791d1e5de3f5f5044b;hp=7e0eb3f0f80fd7985baa43b28af771873f02445a;hpb=9f55e1929c1786f07659130872cbcf952ce7c099;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index 7e0eb3f0f..11811c422 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -19,6 +19,8 @@ #include #include +#include +#include #include @@ -58,7 +60,7 @@ void ModuleBase_WidgetSelector::onSelectionChanged() //******************************************************************** void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone) { - // "false" flag should be used here, it connects to the #26658 OCC bug, when the user click in + // "false" flag should be used here, it connects to the #26658 OCC bug, when the user click in // the same place repeatedly without mouse moved. In the case validation by filters is not // perfromed, so an invalid object is selected. E.g. distance constraint, selection of a point. // the 3rd click in the same point allow using this point. @@ -78,7 +80,8 @@ void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone) QIntList ModuleBase_WidgetSelector::getShapeTypes() const { QIntList aShapeTypes = shapeTypes(); - if (/*aShapeTypes.contains(TopAbs_SOLID) ||*/ // this type should be mentioned in XML, poor selection otherwise + // this type should be mentioned in XML, poor selection otherwise + if (/*aShapeTypes.contains(TopAbs_SOLID) ||*/ aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result/*TopAbs_SHAPE*/)) { // it should be selectable for both, "solids" and "objects" types aShapeTypes.append(TopAbs_COMPSOLID); @@ -162,7 +165,7 @@ void ModuleBase_WidgetSelector::activateCustom() { connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()), Qt::UniqueConnection); - + activateSelectionAndFilters(true); // Restore selection in the viewer by the attribute selection list @@ -195,7 +198,8 @@ bool ModuleBase_WidgetSelector::setSelectionCustom(const ModuleBase_ViewerPrsPtr getGeomSelection(thePrs, anObject, aShape); // the last flag is to be depending on hasObject is called before. To be corrected later - return ModuleBase_Tools::setObject(attribute(), anObject, aShape, myWorkshop, myIsInValidate, true); + return ModuleBase_Tools::setObject(attribute(), anObject, aShape, + myWorkshop, myIsInValidate, true); } //******************************************************************** @@ -204,7 +208,22 @@ void ModuleBase_WidgetSelector::deactivate() ModuleBase_ModelWidget::deactivate(); disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); activateSelectionAndFilters(false); - ModuleBase_ModelWidget::deactivate(); + + /// clear temporary cash + AttributePtr anAttribute = attribute(); + if (!anAttribute.get()) + return; + std::string aType = anAttribute->attributeType(); + if (anAttribute->attributeType() == ModelAPI_AttributeSelection::typeId()) { + AttributeSelectionPtr aSelectAttr = + std::dynamic_pointer_cast(anAttribute); + aSelectAttr->removeTemporaryValues(); + } + else if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) { + AttributeSelectionListPtr aSelectAttr = + std::dynamic_pointer_cast(anAttribute); + aSelectAttr->removeTemporaryValues(); + } } //********************************************************************