Page MenuHomePhabricator

Initialization of RenderWindows at startup only works with a workaround
Closed, ResolvedPublic

Description

When starting an MITk application with QmitkRenderWindow instances, the render windows are only correctly initialized (i.e. with correct size information, DisplayGeometry etc.) when calling either

show() and showFullScreen()

or

show() and resize(x,y)

together. Otherwise, the render windows are initialized with wrong size information, and the displayed image is often quite distorted.

This could be a Qt problem, but maybe the problem is in QmitkRenderWindow itself.

Should check if in any way the problem can be solved by modifying QmitkRenderWindow (e.g. its constructor) with some Qt magic.

Event Timeline

The problem behind this bug is that a new Renderwindow is initialized with a size that is given by the Windows-API.
All rendering-relevant parameters (e.g. geometry) are then initialized according to this size.

When show() is called, a QResizeEvent, coming out of the depths of the QT-Event-Loop, is performed setting a correct size.

After this, the geometry is not adjusted to the new size as some QT-Flags declare this renderwindow as not visible (although it may well be).

However in QmitkRenderWindow::ResizeEvent() the Geometry is only updated when the RenderWindow is visible.

RW not visible -> no Geometry update -> Geometry does not fit the size of the RenderWindow

The problem behind this bug is that a new Renderwindow is initialized with a size that is given by the Windows-API.
All rendering-relevant parameters (e.g. geometry) are then initialized according to this size.

When show() is called, a QResizeEvent, coming out of the depths of the QT-Event-Loop, is performed setting a correct size.

After this, the geometry is not adjusted to the new size as some QT-Flags declare this renderwindow as not visible (although it may well be).

However in QmitkRenderWindow::ResizeEvent() the Geometry is only updated when the RenderWindow is visible.

RW not visible -> no Geometry update -> Geometry does not fit the size of the RenderWindow

Could you add a patch of your changes?

Patch to make initialization of RenderWindow work correctly.

Apply on QmitkRenderWindow!

[SVN revision 22834]
FIX (#3955): removed if-clause checking for visibility of RenderWindow when resizing