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.ro...@tu-cottbus.de] 
Gesendet: Dienstag, 21. Mai 2013 12:44
An: 'paraview@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




_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to