[vtkusers] How to put Qt widgets on top of a VTK OpenGL scene

Elvis Dowson elvis.dowson at mac.com
Wed Oct 15 07:26:58 EDT 2008


Hmmm, not sure how to proceed. The QVTKWidget inherits from QWidget.  
However, you may need to somehow use QGLWidget instead of QWidget, in  
order to get Qt widgets to render within an OpenGL scene.

VTK does it's own implementation of QWidget to add OpenGL rendering  
support, resulting in the QVTKWidget plugin.

VTK also has a USE_QOPENGL configure command to use Qt's OpenGL  
implementation.

Not sure how all this ties in together, but does this somehow imply  
that if you set USE_QOPENGL configure option somehow will be using  
QGLWidget instead of QWidget or something? The generated headers for  
QVTKWidget plugin doesn't seem to indicate this.

Best regards,

Elvis Dowson


On Oct 15, 2008, at 2:30 PM, Elvis Dowson wrote:

> Hi,
>          Here's what I've found out so far. It appears to be  
> feasible, I think. (fingers crossed!!) :-)
>
> Extract from Qt 4.4.3: QGraphicsView Class Reference
>
> By default, QGraphicsView provides a regular QWidget for the  
> viewport widget. You can access this widget by calling viewport(),  
> or you can replace it by calling setViewport(). To render using  
> OpenGL, simply call setViewport(new QGLWidget). QGraphicsView takes  
> ownership of the viewport widget.
>
> Now QVTKWidget inherits from QWidget, so I'm thinking a test could  
> be to use QVTKWidget to render a VTK actor and then get a Qt widget  
> to appear next to the actor and display some actor properties when  
> you double click on the actor.
>
> Best regards,
>
> Elvis Dowson
>
>

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


More information about the vtkusers mailing list