Results 1 to 10 of 10

Thread: Widget auto shrink

  1. #1
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Widget auto shrink

    My Widget grows according to the widget added to it's layout, but when the size of it's children change (smaller) the widget won't shrink. I've tried updating it's geometry when it's children change but to no avail.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: Widget auto shrink

    Resize the widget yourself or set a size constraint on the widget's layout.
    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.


  3. #3
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Widget auto shrink

    Qt Code:
    1. layout->setSizeConstraint(QLayout::SetMinimumSize);
    To copy to clipboard, switch view to plain text mode 
    Doesn't fix it.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: Widget auto shrink

    Why would it fix it?
    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.


  5. #5
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Widget auto shrink

    or set a size constraint on the widget's layout
    Isn't that a size constraint?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: Widget auto shrink

    There are more to pick from. Did you read in the docs what each of them does?
    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.


  7. #7
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Widget auto shrink

    I have, but none of them size contraints seem to do anything diferent than set maximum/minimum hight and widht.
    I guess I have to do it all by hand.
    Last edited by been_1990; 23rd January 2013 at 23:14.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: Widget auto shrink

    Do you know what the size constraint on the layout does?
    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.


  9. #9
    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: Widget auto shrink

    Take a look at the Extension Example because it does exactly what you are asking for.

  10. #10
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Widget auto shrink

    QLayout::SetFixedSize worked. Don't know why...

Similar Threads

  1. Auto adjust width of widget
    By Sjaacko in forum Newbie
    Replies: 4
    Last Post: 7th October 2011, 07:47
  2. How to shrink a dialog
    By lotek in forum Newbie
    Replies: 3
    Last Post: 11th June 2011, 09:49
  3. Shrink Text
    By lamp in forum Qt Programming
    Replies: 5
    Last Post: 30th November 2010, 06:30
  4. Auto resize Widget to maximum avail. space
    By pospiech in forum Qt Programming
    Replies: 16
    Last Post: 15th April 2008, 14:47
  5. auto resize custom widget
    By CopyrightPhilly in forum Newbie
    Replies: 1
    Last Post: 5th October 2007, 09:40

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.