[Paraview] Fetching selection from SpreadSheet

Stephan Rogge Stephan.Rogge at tu-cottbus.de
Thu May 23 08:46:43 EDT 2013


Ok, rather than fetching the vtkTable's data directly I read out the "Row
Id" of the selected row in my SpreadSheetView. This is done by connecting to
the "pqView::selected (pqOutputPort* opp)" signal to my slot "pqMyPanel::
selectionChanged(pqOutputPort* opp)". The slot read the specific "IDs":

void pqMUDIIPanel::selectionChanged(pqOutputPort* opp)
{
  if (opp)
    {
    vtkSMSourceProxy *activeSelection = opp->getSelectionInput();  
   if(activeSelection)
      {
      vtkSMVectorProperty* vp = 
          vtkSMVectorProperty::SafeDownCast(
activeSelection->GetProperty("IDs"));    
     QList<QVariant> ids = pqSMAdaptor::getMultipleElementProperty(vp);
      if(!strcmp(activeSelection->GetXMLName(),
"CompositeDataIDSelectionSource"))
        {
        this->SelectedRowId = ids.at(2).toInt();         
        }
      }
   }
}

The "Row Id" can be used to work within the table on pure VTK-level via
proxy properties. Hope this could help someone with a similar question.

Cheers,
Stephan

-----Ursprüngliche Nachricht-----
Von: Stephan Rogge [mailto:Stephan.Rogge at tu-cottbus.de] 
Gesendet: Dienstag, 21. Mai 2013 12:44
An: 'paraview at paraview.org'
Betreff: Fetching selection from SpreadSheet

Hello,

I use the SpreadSheetView to visualize a vtkTable. Now I want to fetch the
data of the row which is currently selected.
Right now I can connect to a selection event but have no idea to obtain the
slected data row.

pqSpreadSheetView *ssv = qobject_cast<pqSpreadSheetView*>(view);
QWidget *widget = ssv->getWidget();
QObject::connect(
     ssv->getViewModel(), SIGNAL(selectionChanged(const QItemSelection&)), 
      this, SLOT(spreadSheetSelectionChanged(const QItemSelection&)));

When my slot is called, QItemSelection is empty.

Cheers,
Stephan






More information about the ParaView mailing list