Salome HOME
Issue #1953: Synchronize selection on widget activation
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 29 Dec 2016 12:51:44 +0000 (15:51 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 29 Dec 2016 12:52:03 +0000 (15:52 +0300)
src/CollectionPlugin/CollectionPlugin_WidgetField.cpp
src/CollectionPlugin/CollectionPlugin_WidgetField.h

index a9e83048fa02522ff5c7a4d0f027ffce77490b2e..55b8066127e6f911fffde266df517c4a958f860f 100644 (file)
@@ -969,3 +969,24 @@ void CollectionPlugin_WidgetField::onColumnResize(int theIndex, int theOld, int
       aTable->setColumnWidth(theIndex, theNew);
   }
 }
+
+//**********************************************************************************
+QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+  CollectionPlugin_WidgetField::getAttributeSelection() const
+{
+  QList<std::shared_ptr<ModuleBase_ViewerPrs>> aList;
+  if(myFeature) {
+    DataPtr aData = myFeature->data();
+    AttributeSelectionListPtr aSelList =
+      aData->selectionList(CollectionPlugin_Field::SELECTED_ID());
+    AttributeSelectionPtr aAttr;
+    ObjectPtr anObject;
+    for (int i = 0; i < aSelList->size(); i++) {
+      aAttr = aSelList->value(i);
+      ModuleBase_ViewerPrsPtr
+        aPrs(new ModuleBase_ViewerPrs(aAttr->context(), aAttr->value(), NULL));
+      aList.append(aPrs);
+    }
+  }
+  return aList;
+}
\ No newline at end of file
index 78af65eb1fc3c438a55bfd30ea8481a0e3dd9585..3bd98f95c7c4f5aeb38187905a35243fa3eb0c94 100644 (file)
@@ -101,6 +101,11 @@ protected:
 
   //virtual void showEvent(QShowEvent* theEvent);
 
+  /// Return the attribute values wrapped in a list of viewer presentations
+  /// \return a list of viewer presentations, which contains an attribute result and
+  /// a shape. If the attribute do not uses the shape, it is empty
+  virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
+
 protected slots:
   /// Slot which is called on selection event
   virtual void onSelectionChanged();