Salome HOME
Issue #1906: Use validators for the field panel
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 13 Dec 2016 13:36:59 +0000 (16:36 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 13 Dec 2016 13:36:59 +0000 (16:36 +0300)
src/CollectionPlugin/CollectionPlugin_WidgetField.cpp
src/CollectionPlugin/CollectionPlugin_WidgetField.h
src/CollectionPlugin/plugin-Collection.xml

index de74d3c4643831c3160cece278e3346aa6a589a9..fbf74355733b347be345dbd3a4f15cbc3e539b9b 100644 (file)
@@ -793,7 +793,7 @@ void CollectionPlugin_WidgetField::onStepMove(int theStep)
 
 //**********************************************************************************
 bool CollectionPlugin_WidgetField::
-  isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs)
+  isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs)
 {
   return (myShapeTypeCombo->currentIndex() == 5)? false : true;
 }
@@ -812,8 +812,7 @@ void CollectionPlugin_WidgetField::onSelectionChanged()
   if (myShapeTypeCombo->currentIndex() == 5)
     return;
 
-  QList<ModuleBase_ViewerPrsPtr> aSelected =
-    myWorkshop->selection()->getSelected(ModuleBase_ISelection::AllControls);
+  QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
 
   AttributeSelectionListPtr aSelList =
     myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID());
index 5f202f5517889c332f11fbd61689f5137cd55031..d732d99d408e86d692f8829dc7014ca7e7110604 100644 (file)
@@ -51,7 +51,7 @@ public:
   /// Checks the widget validity. By default, it returns true.
   /// \param thePrs a selected presentation in the view
   /// \return a boolean value
-  virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
+  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
 
   /// Returns true if the event is processed.
   virtual bool processEnter();
index 33042ac490d29ec6b9657d5f470ff129da9adb80..6ebd05466c8ab6af5b0c6513743e0c575c975420 100644 (file)
@@ -14,7 +14,9 @@
         title="Field"
         tooltip="Create create fields for selected shapes"
         icon="icons/Collection/field.png">
-        <field-panel/>
+        <field-panel id="selected">
+          <validator id="GeomValidators_BodyShapes"/>
+        </field-panel>
       </feature>      
     </group>
   </workbench>