[vtkusers] QVtkWidgets in a QGraphicsView (QGraphicsScene)

Clinton Stimpson clinton at elemtech.com
Mon Mar 16 12:08:10 EDT 2009


There is now an example in VTK/Examples/GUI/Qt/GraphicsView you might be 
interested in.
Contributions to improve it are welcome. 
Depending on what you're trying to do with transparent overlays, this 
could be a workable alternative.  I think transparent overlays between 
OpenGL and non-OpenGL windows requires extra coordination at the 
X11/Win32/Carbon level, and I'm not sure if Qt provides the facilities 
to make that work.  It seems this has been discussed on the Qt list in 
the past.  Have you looked there?

You can do redirected painting with a call like:
QPixmap::grabWidget(myqvtkwidget);

It looks like QGraphicsProxyWidget::paint relies on redirected painting 
to embed a widget (or QVTKWidget in your case) into a QGraphicsView.  I 
don't see anything that should prevent it from working, but if you had 
an example that demonstrates the problem, that would help.

Clint

J.S.Wijnhout at lumc.nl wrote:
>> Nobody knows where the problem comes from ?
>> Is there any other way to display QVTKWidgets in a QGraphicsView ?
>>     
>
> I have been experimenting with QVTKWidget lately (in particular, I tried
> to create an overlay widget on top of the QVTKWidget). The QVTKWidget is
> rather special since it, basically takes the standard vtkRenderWindow
> and embeds it inside a QWidget. For this to work properly it sets the
> Qt::WA_PaintOnScreen attribute (I'm talking about Qt4 here). This
> effectively makes it impossible for me to create transparent overlays.
> I'm not sure but I can imagine that you are running into the same
> problem.
>
> The QVTKWidget supports redirected painting, but honestly, I have no
> clue how to set that up (If it is going to solve anything at all).
>
> best,
> Jeroen
>
> Vincent Gratsac wrote:
>   
>> Hi all,
>>
>> I'm trying to add some QVTKWidgets in a QGraphicsView since a few 
>> days, but I don't succeed in it : displayed objects are empty. 
>> Actually, I can display a QVTKWidget in a simple QWidget, but the 
>> problem seems to come from the QGraphicsView which is unable to 
>> display it.
>>
>> Has anyone ever meet this problem ? Can someone help me ?
>>
>> Thank you,
>>
>> Vincent
>> _______________________________________________
>> 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
>>     
> _______________________________________________
> 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
> _______________________________________________
> 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
>   




More information about the vtkusers mailing list