[vtkusers] problems with QVTKWidget and vtkCellPicker

Dominik Szczerba domi at vision.ee.ethz.ch
Fri Jun 23 11:53:03 EDT 2006


Hi,

I am modifying the QVTKWidget to add a picker slot:

void QVTKWidget::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:

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. 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
it works fine?

regards,
Dominik


-- 
Dominik Szczerba, Dr.
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi



More information about the vtkusers mailing list