[vtkusers] How to get a vtkContextView into a QWidget?

da remywendy at gmail.com
Wed Apr 21 18:19:03 EDT 2010


Thanks Eric.

I ended up doing something like this

vtkSmartPointer<QVTKInteractor> renderWindowInteractor =
vtkSmartPointer<QVTKInteractor>::New();
renderWindowInteractor->SetRenderWindow(*(vtkContextView)*
->GetRenderWindow());
renderWindowInteractor->Initialize();

*(QVTKWidget)*->SetRenderWindow(*(vtkContextView)*->GetRenderWindow());

since QVTKWidget requires a QVTKInteractor as the Interactor. I created a
new QVTKInteractor, attached it as vtkContextView's interactor, and then
just set the renderwindow from context view into the qvtkwidget.

(BTW, thanks to the guys developing the new chart classes, they look very
nice! Especially in Paraview!)


On Wed, Apr 21, 2010 at 12:11 PM, Eric E. Monson <emonson at cs.duke.edu>wrote:

> Hello,
>
> As long as you are programming in C++ I think you can follow the examples
> in [vtksource]/Examples/Infovis/Cxx -- there they have things like EasyView
> that put a vtkGraphLayoutView into a QVTKWidget. I haven't tried this with
> the Charts specifically, but since vtkContextView is also a vtkRenderView,
> hopefully you can do the same thing:
>
>  // Graph View needs to get my render window
>
>  this->GraphView->SetInteractor(this->ui->vtkGraphViewWidget->GetInteractor());
>
>  this->ui->vtkGraphViewWidget->SetRenderWindow(this->GraphView->GetRenderWindow());
>
> (The reason I say that hopefully you're using C++ is that I can't get this
> to work with the Python wrappers and PyQt4...)
>
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
> On Apr 21, 2010, at 12:28 PM, da wrote:
>
> > Hey everyone,
> >
> > I've been playing around with the plotting functionality: first the older
> vtkQt* classes and now I'm looking at VTK/Charts classes. It seems that
> vtkContextView is an entire "view" in itself. How would I get this embedded
> into a QWidget? I've been using QVTKWidget previously but I don't think I
> can just put the renderer from the context view into the qvtkwidget?
> >
> >
> > _______________________________________________
> > 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100421/c6f78ed7/attachment.htm>


More information about the vtkusers mailing list