[vtkusers] Qt4 - adding a QVTKWidget to QMdiArea nulls the render window of the renderers

shekharc Shekhar.Chandra at sci.monash.edu.au
Wed Dec 12 18:36:06 EST 2007


Hi John,

I suggest u use QWorkspace instead, it should allow u todo exactly the 
same thing as QMdiArea. I have used this very successfully. This is 
because QMdiArea is mainly designed to use subclasses of QMdiSubWindow 
(as evident from setActive and currentWindow members) and QVTKWidget is 
probably only derived from QWidget. See the MDI Example in the docs for 
more info.

Hope that helps.
Cheers
Shakes

John Platt wrote:
> Hi,
> 
>  
> 
> Creating a QVTKWidget derived object, something like
> 
>  
> 
> class MdiChild : public QVTKWidget
> 
> {
> 
>     MdiChild() {   ren = vtkRenderer::New();
> 
>                        GetRenderWindow()->AddRenderer( ren ); ………… }
> 
>    ………
> 
> }
> 
>  
> 
> and adding to a QMdiArea::addSubWindow() nulls the render window 
> associated with the renderer (ren->GetRenderWindow()). This causes other 
> vtk objects which get the render window from the renderer to crash (eg. 
> vtkOrientationMarkerWidget).
> 
>  
> 
> It appears that QMdiArea::addSubWindow() reparents the MdiChild. 
> QEvent::ParentAboutToChange is trapped by QVTKWidget::event which 
> eventually calls vtkWin32OpenGLRenderWindow::Clean() where
> 
>       ren->SetRenderWindow(NULL); occurs.
> 
>  
> 
> The QEvent::ParentChange doesn’t reset the render window for the 
> renderer list.
> 
>  
> 
> I don’t pretend to understand what should happen. Perhaps 
> GetRenderWindow() should not be called until after addSubWindow() or 
> QEvent::ParentChange should add the render window back to each renderer.
> 
>  
> 
> Any advice or suggestions would be very much appreciated,
> 
>  
> 
> TIA
> 
>  
> 
> John.
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the 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