MantisBT - VTK
View Issue Details
0003441VTK(No Category)public2006-06-24 14:152013-04-05 19:56
Dominik Szczerba 
Clinton Stimpson 
highmajoralways
closedno change required 
 
 
0003441: problems with QVTKWidget and vtkCellPicker
I am sending an EndPickEvent to a slot in a widget containing a QVTKWidget:

void aWidget::pick(vtkObject* caller){
  vtkRenderWindowInteractor* iren =
vtkRenderWindowInteractor::SafeDownCast(caller);

 vtkCellPicker *cellPicker = (vtkCellPicker *)iren->GetPicker();
  cellPicker->PrintSelf(cerr,vtkIndent());
  long id = cellPicker->GetCellId();
  cerr << "cellPicker->GetCellId() = " << id << endl;
}

I connect to it as follows during the widget's initialization:

vtkEventQtSlotConnect* connections = vtkEventQtSlotConnect::New();
connections->Connect(widget.GetRenderWindow()->GetInteractor(),
vtkCommand::EndPickEvent,&widget,SLOT(pick(vtkObject*)));
connections->PrintSelf(cerr, vtkIndent());

The slot routine is invoked properly with the 'p' hey and all infos from PrintSelf make
sense (e.g. event position, window size, etc.), but GetCellId() doesnt
(big negative constant). What am I doing wrong, with "plain" vtkCommands (without Qt)
it works fine?

regards,
Dominik
No tags attached.
Issue History
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2013-04-05 19:56Berk GeveciStatuscustomer review => closed

Notes
(0007863)
Clinton Stimpson   
2007-06-12 16:49   
Works for me.

What if you change
vtkCellPicker *cellPicker =
  (vtkCellPicker*)iren->GetPicker();

to
vtkCellPicker* cellPicker =
  vtkCellPicker::SafeDownCast(iren->GetPicker());

just to be sure you have a vtkCellPicker?

If I took my vtkCellPicker out and used the default one (not a vtkCellPicker) then I got large negative numbers.