Results 1 to 4 of 4

Thread: How to shrink a dialog

  1. #1
    Join Date
    Sep 2010
    Posts
    62
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to shrink a dialog

    Hello,

    I have dialog with a widget in a layout. The widget can be set as visible or not (setVisible(bool) method.
    After setting the widget visible the dialog grows - that is correct, but after setting widget invisible the dialog does not shrink back. Is there any possibility to make the dialog shrinking automatically?
    ( apart from remembering of the original size and resize)

    Thanks for your help,

    regards,

    me

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to shrink a dialog

    Yes, it is possible to do so this way. When the dialog is empty, what is the size you want the dialog to be? (say w, h), use setMaximumSize(w, h) on the dialog, and then add your widgets to the dialog, the dialog grows, then when you hide the widget the dialog will shrink the size set by you. Remember to call adjustSize() on the dialog after setVisible(false) on the widget.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to shrink a dialog

    [wiki]Expanding dialog[/wiki]
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Sep 2010
    Posts
    62
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to shrink a dialog

    Thank You,

    Both solutions work perfectly!

Similar Threads

  1. How to access objects of parent Dialog from Child Dialog .
    By ranjit.kadam in forum Qt Programming
    Replies: 4
    Last Post: 18th April 2011, 06:39
  2. Shrink Text
    By lamp in forum Qt Programming
    Replies: 5
    Last Post: 30th November 2010, 06:30
  3. QListWidget shrink to fit size of items
    By woodtluk in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2010, 21:42
  4. Resizing a QLabel with a pimap. Won't shrink!
    By dh7892 in forum Qt Programming
    Replies: 2
    Last Post: 17th September 2010, 17:30
  5. Shrink QMainWindow to Minimum Size
    By kloffy in forum Qt Programming
    Replies: 4
    Last Post: 17th February 2008, 17:54

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.