Results 1 to 7 of 7

Thread: restorGeometry() is not working... or maybe a contained Widget/layout causes resize?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default restorGeometry() is not working... or maybe a contained Widget/layout causes resize?

    I'm using saveGeometry/saveState and restorGeometry/restoreState as documented here:

    http://doc.qt.io/qt-4.8/restoring-geometry.html

    When I start the application, the QMainWindow has the same width as when it was closed, but its height grows so that the bottom part of the widget is not visible. I resize the window and exit, but the new height is not restored on the next application start-up.

    If I set a maximum size on the QMainWindow, this can be avoided. But, I don't want to do that since at a different screen resolution, a bigger QMainWindow height wouldn't be an issue.

    Can a layout or widgets inside a QMainWindow cause it to grow in size after its geometry is restored?

    If not, what else might be causing this?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: restorGeometry() is not working... or maybe a contained Widget/layout causes resi

    Depends on when you restore the geometry.

    When it is done before the layouts have done their work, then the window might grow if the current size is smaller than the overall preferred size.

    Cheers,
    _

Similar Threads

  1. Replies: 6
    Last Post: 25th March 2013, 10:14
  2. Replies: 3
    Last Post: 11th April 2012, 10:17
  3. Resize widget to layout inside it.
    By mrc_pl in forum Newbie
    Replies: 2
    Last Post: 14th January 2012, 20:22
  4. Replies: 0
    Last Post: 18th January 2011, 16:59
  5. Resize widget force layout resizing
    By ^NyAw^ in forum Qt Programming
    Replies: 17
    Last Post: 11th February 2009, 11:27

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.