From c70c6a7ce45784d6a1dc9cd972a940a79fdb692e Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 25 Sep 2014 15:10:30 +0400 Subject: [PATCH] Use pre-selection for shape selector --- src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index d4294aa2b..c4832dd8f 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -167,6 +167,15 @@ void ModuleBase_WidgetShapeSelector::onSelectionChanged() bool ModuleBase_WidgetShapeSelector::isAccepted(const ObjectPtr theResult) const { ResultPtr aResult = boost::dynamic_pointer_cast(theResult); + if (myFeature) { + // We can not select a result of our feature + const std::list>& aRes = myFeature->results(); + std::list >::const_iterator aIt; + for (aIt = aRes.cbegin(); aIt != aRes.cend(); ++aIt) { + if ((*aIt) == aResult) + return false; + } + } boost::shared_ptr aShapePtr = ModelAPI_Tools::shape(aResult); if (!aShapePtr) return false; @@ -227,6 +236,9 @@ void ModuleBase_WidgetShapeSelector::activateSelection(bool toActivate) connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); else disconnect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); + + if (myWorkshop->selectedObjects().size() > 0) + onSelectionChanged(); } //******************************************************************** -- 2.39.2