[vtkusers] Using vtkRenderWindow with QGraphicsView [Qt 4.4.1]

clinton at elemtech.com clinton at elemtech.com
Thu Aug 28 14:24:43 EDT 2008


I would recommend implementing a QPaintEngine for the QVTKWidget, instead of 
what you're trying to do.  Then it should simply be a matter of setting a 
QVTKWidget as the viewport of the QGraphicsView.

I've done some experimenting with a QPaintEngine for QVTKWidget before, but I 
haven't done enough to get something to commit into the repository.  Do you 
want some of that code to play with too?

Clint

> Hi All,
>
> This months Qt Quarterly magazine had an interesting article titled
> "Accelerate your Widgets with OpenGL". The article explains a way for
> developers to use OpenGL viewports in QGraphicsView and layer widgets (any
> QWidget) as items (instances of QGraphicsProxyWidget) on top of 3D areas.
>
> [1]
> http://labs.trolltech.com/blogs/2008/06/27/accelerate-your-widgets-with-ope
>ngl/ [2]
> http://labs.trolltech.com/blogs/wp-content/uploads/2008/06/openglwidgets2.p
>ng
>
> Anyways, I was playing around with QVTKWidget, vtkQtRenderWindow and
> QGraphicsView. I thought it should be possible for us to create a subclass
> of QGraphicsView that would help render VTK scenes from within the
> drawBackground() method of QGraphicsView. I did give it a shot and I got
> some results, but its not exactly what I want. I am able to get 3D output
> on the viewport, but the items in the scene are not visible.
>
> Could anyone please help me with this?
>
> [3] Download the code I have so far from here:
> http://www.vcreatelogic.com/oss/VTKGraphicsView.zip
>      * Note, I have only tested the code on Windows so far.
>
> Thanks and Warm Regards,
> Prashanth N Udupa





More information about the vtkusers mailing list