[vtkusers] Trouble using VTK Widget with QVTK

AdrienV adrien.voisin.be at gmail.com
Sun Jun 8 10:44:06 EDT 2014


Hi,


I'm working on an application using C++, VTK and Qt framework. I have
integrated a vtk window in a Qt widget and all work fine.

But now I want to use vtkWidget (vtkContourWidget) with the QVTK interactor.
As for others vtk Widget, it is not working (nothing happens, but the
compilation/execution steps are ok. For example, if the widget is a
vtkCaptionWidget, nothing appears on the rendering window)

Here a piece of my code :

   vtkSmartPointer<vtkContourWidget> contourWidget =
       vtkSmartPointer<vtkContourWidget>::New();
      // The QVTK related part
    
contourWidget->SetInteractor(ui->vtkWidget->GetRenderWindow()->GetInteractor());
  

     vtkOrientedGlyphContourRepresentation* rep =
       vtkOrientedGlyphContourRepresentation::SafeDownCast(
       contourWidget->GetRepresentation());

     vtkSmartPointer<vtkPolygonalSurfacePointPlacer> pointPlacer =
       vtkSmartPointer<vtkPolygonalSurfacePointPlacer>::New();
     pointPlacer->AddProp(actor);
     pointPlacer->GetPolys()->AddItem(sphereSource->GetOutput());

     rep->GetLinesProperty()->SetColor(1, 0, 0);
     rep->GetLinesProperty()->SetLineWidth(3.0);
     rep->SetPointPlacer(pointPlacer);

If I use the native interactor 

     vtkSmartPointer<vtkRenderWindowInteractor> interactor =
       vtkSmartPointer<vtkRenderWindowInteractor>::New();
     interactor->SetRenderWindow(renderWindow);

 vtkSmartPointer<vtkContourWidget> contourWidget =
       vtkSmartPointer<vtkContourWidget>::New();
     contourWidget->SetInteractor(interactor);

It works. 
But I have to use the QVTK interactor instead.

Any idea?


Thanks a lot


Adrien




--
View this message in context: http://vtk.1045678.n5.nabble.com/Trouble-using-VTK-Widget-with-QVTK-tp5727389.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list