PDA

View Full Version : Preventing the resizing of non-active QMdiSubWindows



zenzero-2001
29th January 2011, 14:53
Hello,

In my MDI application I have the ability to enter a fullscreen mode, whereby all toolbars, dock widgets etc are hidden, then both the main window and the active subwindow are maximized.

If there are other non-active QMdiSubWindows open and already maximized then these are resized when the active subwindow is put into fullscreen mode. This is because hiding the toolbars etc triggers a resize in the maximized non-active subwindows (but not non-active normal size subwindows).

I wish to find a way to prevent the implicit resizing of the maximized non-active subwindows when entering the fullscreen mode for the active subwindow.

I have a boolean in the main window (fullscreenTransition) which I set when entering / exiting fullscreen mode. I check this and whether the subwindow widget is the active one in the resize event of the subwindow widget and skip the resize under the appropriate condition:


if(mainWindow->activeMdiWidget() != qobject_cast<MdiWidget*>(this) && mainWindow->isFullScreenTransition())
{
return;
}

Unfortunately, it doesn't work because the fullScreenTransition boolean is set back to false before the resize of the non-active subwindows is triggered / completed.

I guess I need to override or intercept the event / signal that resizes the non-active subwindows and set my fullScreenTransition boolean back to false in there. Does anybody know how to do this or where it might give me a clue in the documentation?

Any help greatly appreciated, thanks!

zenzero-2001
29th January 2011, 18:15
Ok, I have solved my problem :) I moved the fullScreenTransition boolean to the subWindow and I set it to true from the mainWindow if it is the activeWindow. The boolean remains false for the non-active subwindows.

Added after 22 minutes:

That wasn't quite right, I need to set it in the non-active subwindows. I obviously need to get some sleep :o

zenzero-2001
29th January 2011, 20:06
Nope, still doesn't work because resize is called multiple times. Back to the drawing board.

zenzero-2001
31st January 2011, 10:59
I fixed the problem :) I hid the subwindows before entering fullscreen mode and show them again after exiting fullscreen mode. A single resize event still occurs per subwindow, but the window is the same size as it was originally so it does not matter in my case. In the docs, under QWidget, QSize it states:


If the widget is visible when it is being resized, it receives a resize event (resizeEvent()) immediately. If the widget is not currently visible, it is guaranteed to receive an event before it is shown.