[vtkusers] Using VTK widgets in Qt renderers

David Doria daviddoria+vtk at gmail.com
Mon Feb 8 10:06:46 EST 2010


Is there a trick to turning on widgets in a Qt renderer?

I tried the normal code (below) I use to turn on a widget, but it does not
appear in the renderer:

 this->ui->qvtkWidgetRight->GetRenderWindow()->AddRenderer(rightRenderer);

  //add a border widget to the right renderer
  vtkSmartPointer<vtkBorderWidget> borderWidget =
      vtkSmartPointer<vtkBorderWidget>::New();

  borderWidget->SetInteractor(this->ui->qvtkWidgetRight->GetRenderWindow()->GetInteractor());

  static_cast<vtkBorderRepresentation*>(borderWidget->GetRepresentation())->GetBorderProperty()->SetColor(1,0,0);
//red

  borderWidget->SelectableOff();
    vtkSmartPointer<BorderCallback> borderCallback =
      vtkSmartPointer<BorderCallback>::New();

  borderWidget->AddObserver(vtkCommand::InteractionEvent,borderCallback);

  borderWidget->On();

Is there something special that must be done to get them to work inside a Qt
render window?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100208/22992031/attachment.htm>


More information about the vtkusers mailing list