[vtkusers] Qt4 - adding a QVTKWidget to QMdiArea nulls the render window of the renderers
John Platt
jcplatt at dsl.pipex.com
Thu Dec 13 17:48:30 EST 2007
Hi Shakes,
I hadn't thought about that. I'm still trying to find my way around Qt
so I just took the Qt4 MDI sample and started piling in the VTK stuff!
For the time being I am just resetting the render window in the
renderer.
Your help is very much appreciated.
John.
-----Original Message-----
From: shekharc [mailto:Shekhar.Chandra at sci.monash.edu.au]
Sent: 12 December 2007 23:36
To: John Platt
Cc: vtk Users
Subject: Re: [vtkusers] Qt4 - adding a QVTKWidget to QMdiArea nulls the
render window of the renderers
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