Results 1 to 3 of 3

Thread: How to resize a Mdi child?

  1. #1
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    253
    Thanks
    23
    Thanked 16 Times in 13 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question How to resize a Mdi child?

    Hi,

    I have an application that uses mdi childs. This childs are defined in the UI as 800x600 but when I create a new child the application sets it to 264x489.. And I don't see how to change this in code. I can resize them with the mouse though.

    I tried resize(...) or setGeometry(...) but nothing works out.

    Any idea what I am missing?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to resize a Mdi child?

    If you want to set a minimum size, you can use setMinimumSize or setMinimumSizeHint.
    Last edited by tbscope; 6th May 2010 at 21:07. Reason: more info

  3. #3

    Default Re: How to resize a Mdi child?

    After much searching for an answer, and experimenting, I found this to work for me.

    Qt Code:
    1. child->parentWidget()->resize(900, 700);
    2. child->parentWidget()->updateGeometry();
    3. child->show();
    4. // child->showMaximized();
    To copy to clipboard, switch view to plain text mode 
    You can use showMaximized() in place of show() and the (900, 700) will still be used if the window is later changed to normal.
    Last edited by harveyab; 25th May 2016 at 20:53. Reason: Had it right the first time, sigh. Fixed again.

Similar Threads

  1. Replies: 1
    Last Post: 2nd May 2010, 00:03
  2. Qt resize child Window...
    By Peppy in forum Qt Programming
    Replies: 6
    Last Post: 12th December 2009, 13:53
  3. Qidget height resize if child widgets invisible
    By visor_ua in forum Qt Programming
    Replies: 1
    Last Post: 27th April 2008, 12:27
  4. Replies: 2
    Last Post: 22nd January 2008, 17:10
  5. Infinite loop - resize parent from child
    By bitChanger in forum Qt Programming
    Replies: 3
    Last Post: 5th May 2006, 14:21

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.