From: vsv Date: Thu, 29 Dec 2016 14:46:30 +0000 (+0300) Subject: Issue #1961: Filter not acceptable shapes and objects X-Git-Tag: V_2.7.0~351^2~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3f7f231a1368624fcdbbc8e9be17d1279c596c17;p=modules%2Fshaper.git Issue #1961: Filter not acceptable shapes and objects --- diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp index 55b806612..509789ad9 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp +++ b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -782,21 +783,25 @@ bool CollectionPlugin_WidgetField:: } //********************************************************************************** -void CollectionPlugin_WidgetField::onSelectionChanged() +bool CollectionPlugin_WidgetField:: + setSelection(QList>& theValues, const bool theToValidate) { - //if (isEditingMode()) - // return; - if (myActivation) { myActivation = false; - return; + return false; } // Ignore selection for Parts mode if (myShapeTypeCombo->currentIndex() == 5) - return; - - QList aSelected = getFilteredSelected(); - + return false; + + QList aSelected; + QList::const_iterator anIt; + for (anIt = theValues.begin(); anIt != theValues.end(); anIt++) { + ModuleBase_ViewerPrsPtr aValue = *anIt; + ResultPtr aRes = std::dynamic_pointer_cast(aValue->object()); + if (theToValidate && aRes.get() && acceptSubShape(aValue->shape(), aRes)) + aSelected.append(aValue); + } AttributeSelectionListPtr aSelList = myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID()); aSelList->setSelectionType(getSelectionType(myShapeTypeCombo->currentIndex())); @@ -859,7 +864,7 @@ void CollectionPlugin_WidgetField::onSelectionChanged() } } } - emit valuesChanged(); + return true; } //********************************************************************************** diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetField.h b/src/CollectionPlugin/CollectionPlugin_WidgetField.h index 3bd98f95c..e0084fcb3 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetField.h +++ b/src/CollectionPlugin/CollectionPlugin_WidgetField.h @@ -82,6 +82,13 @@ public: /// The methiod called when widget is deactivated virtual void deactivate(); + /// Set the given wrapped value to the current widget + /// This value should be processed in the widget according to the needs + /// \param theValues the wrapped selection values + /// \param theToValidate a validation of the values flag + virtual bool setSelection(QList>& theValues, + const bool theToValidate); + protected: /// Saves the internal parameters to the given feature /// \return True in success @@ -106,10 +113,6 @@ protected: /// a shape. If the attribute do not uses the shape, it is empty virtual QList> getAttributeSelection() const; -protected slots: - /// Slot which is called on selection event - virtual void onSelectionChanged(); - private slots: /// Slot called on number of component changed /// \param theVal - a new components number