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

Clinton Stimpson clinton at elemtech.com
Fri Dec 14 14:47:26 EST 2007


Do you mind giving me some example code to reproduce the problem?
I'd like to see if QVTKWidget is doing something wrong here.

Thanks,
Clint

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,
>
>
>   



More information about the vtkusers mailing list