Results 1 to 4 of 4

Thread: Preventing the resizing of non-active QMdiSubWindows

  1. #1
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Preventing the resizing of non-active QMdiSubWindows

    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:

    Qt Code:
    1. if(mainWindow->activeMdiWidget() != qobject_cast<MdiWidget*>(this) && mainWindow->isFullScreenTransition())
    2. {
    3. return;
    4. }
    To copy to clipboard, switch view to plain text mode 

    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!

  2. #2
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Preventing the resizing of non-active QMdiSubWindows

    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
    Last edited by zenzero-2001; 29th January 2011 at 18:15.

  3. #3
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Preventing the resizing of non-active QMdiSubWindows

    Nope, still doesn't work because resize is called multiple times. Back to the drawing board.

  4. #4
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Preventing the resizing of non-active QMdiSubWindows

    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.

Similar Threads

  1. QMDI - custom layout of QMdiSubWindows
    By aado123 in forum Qt Programming
    Replies: 1
    Last Post: 23rd February 2010, 10:41
  2. QMdiSubWindows - Deleting
    By Kerubu in forum Newbie
    Replies: 1
    Last Post: 25th August 2009, 05:23
  3. Weird behaviour with QMdiSubWindows in a QMdiArea?
    By qt_noob in forum Qt Programming
    Replies: 2
    Last Post: 4th April 2009, 16:48
  4. Preventing blue focus rectangle
    By MrGarbage in forum Qt Programming
    Replies: 2
    Last Post: 21st December 2007, 15:36
  5. closeEvent preventing shutdown
    By gfunk in forum Qt Programming
    Replies: 2
    Last Post: 16th October 2007, 19:41

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.