Results 1 to 3 of 3

Thread: sizeHint on QDialog is setting minimum size

  1. #1
    Join Date
    Oct 2013
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Question sizeHint on QDialog is setting minimum size

    I'm trying to get a QDialog subclass to open at a default size but be resizable smaller.
    When I implement sizeHint() to return e.g. QSize(400, 300), the dialog opens at the correct size but then can't be resized smaller, only larger.
    If I remove the sizeHint method the dialog opens at the smallest possible size (50, 50) and can be resized no problem.
    I tried also implementing minimumSizeHint to return (50, 50) but no effect.

    Any ideas?

    Thanks

  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: sizeHint on QDialog is setting minimum size

    What if you just call resize(400, 300) in the dialog's constructor?

    Cheers,
    _

  3. #3
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: sizeHint on QDialog is setting minimum size

    If it is not resizing smaller than the size hint, that sounds to me like you have a Minimum size policy. Did you modify the size policy in your subclass (or in Designer)? You're not calling setMinimumSize() anywhere?

Similar Threads

  1. Replies: 2
    Last Post: 29th June 2011, 17:05
  2. Setting SizeHint in QTreeView.
    By vishal.chauhan in forum Qt Programming
    Replies: 1
    Last Post: 3rd August 2009, 12:03
  3. Replies: 2
    Last Post: 23rd March 2009, 18:26
  4. Minimum QGroupBox size
    By klnusbaum in forum Qt Programming
    Replies: 3
    Last Post: 19th June 2008, 18:22
  5. QMenuBar minimum size
    By Angelo Moriconi in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2007, 22:14

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.