Results 1 to 8 of 8

Thread: Resize MDI subwindows

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Resize MDI subwindows

    If you want to resize the MdiSubWindow then you should call resize() on that object, not the widget it contains:
    Qt Code:
    1. #include "MainWindow.h"
    2. #include "ui_MainWindow.h"
    3.  
    4. MainWindow::MainWindow(QWidget *parent) :
    5. QMainWindow(parent),
    6. ui(new Ui::MainWindow)
    7. {
    8. ui->setupUi(this);
    9.  
    10. m_firstWindow = new FirstWindow;
    11. m_secondWindow = new SecondWindow;
    12. m_thirdWindow = new ThirdWindow;
    13.  
    14. QMdiSubWindow *w1 = ui->mdiArea->addSubWindow( m_firstWindow );
    15. ui->mdiArea->addSubWindow( m_secondWindow );
    16. ui->mdiArea->addSubWindow( m_thirdWindow );
    17.  
    18. w1->resize( 500, 500 );
    19. }
    To copy to clipboard, switch view to plain text mode 

    If your widgets actually contained anything then the containing QMdiSubWindow would get a preferred size from the layout and you probably would not need to resize at all.

  2. The following user says thank you to ChrisW67 for this useful post:

    8Observer8 (17th August 2014)

Similar Threads

  1. QMdiArea Problems with Menu Bar when subWindows are maximized
    By BettaUseYoNikes in forum Qt Programming
    Replies: 1
    Last Post: 6th July 2021, 05:17
  2. subwindows in application - memory usage
    By Tomasz in forum Newbie
    Replies: 6
    Last Post: 23rd July 2010, 08:13
  3. Replies: 5
    Last Post: 15th June 2010, 21:32
  4. display order of subwindows in mdi area
    By eric_vi in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2010, 16:05
  5. QMainWindow...button in subwindows
    By Peppy in forum Qt Programming
    Replies: 1
    Last Post: 15th October 2009, 15:52

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
  •  
Qt is a trademark of The Qt Company.