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

Clinton Stimpson clinton at elemtech.com
Wed Oct 15 17:59:22 EDT 2008


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

> Hi,
>         I've also observed one more thing. In the Trolltech  
> example, we subclass from QGraphicsView, which in turn subclasses  
> from QWidget. QVTKWidget also subclasses from QWidget.
>
> When we use the QVTKPlugin, we're using it with a QDialog, and can  
> drag and drop the QVTKWidget plugin using Qt Designer into a dialog  
> form. QDialog is a subclass of QWidget.
>
> So, in essence, it does not matter if we use a QGraphicsView or  
> QDialog widget, but what matters is that we ensure that we have a  
> QGLWidget ready to draw.
>
> Still haven't figured out the rest of the stuff, but I think there  
> is a possibility that the existing example could be done away with  
> and we adapt it to using just a QVTKWidget plugin, that subclasses  
> from QGLWidget.

I don't how far you'll get with that, but I don't think that should  
be accepted into VTK.
There's no design reason to derive from QGLWidget.  I don't know how  
to think about QGLWidget and vtkRenderWindow getting along when both  
want to manage the OpenGL context.  VTK also allows different OpenGL  
implementations and QGLWidget doesn't.

If VTK's painter classes could be used, then there's not really the  
issue of maintaining an extra bit of code.
Any improvements to the painters would benefit everyone, not just  
QVTKWidget.

Clint




More information about the vtkusers mailing list