Results 1 to 3 of 3

Thread: Prevent a Layout in a Layout from auto-resizing

  1. #1

    Question Prevent a Layout in a Layout from auto-resizing

    Hello, as the title indicates it, I would like to prevent a layout in a bigger layout picture from rezing.
    In other words, let's say I have a 3 lines QVBoxLayout, each of them containing another layout.
    2 out of those 3 should be resized when the bigger window is resized by the user, but the first one, let's say a QFormLayout should remain as thin as possible.
    How do you do that ?
    PS : I am designing this using Qt Designer

  2. #2
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 753 Times in 743 Posts
    Qt products
    Windows Android

    Default Re: Prevent a Layout in a Layout from auto-resizing

    A lot of things you can play around with:

    You can try setting the widgets inside your form layouts to have a maximum height.
    You can also try inserting vertical spacers to force the contents of each layout to the top.
    Try playing with the expansion properties of each widget.
    Try putting the QFormLayout inside of a QFrame inside of the vertical layout, and set the properties of the QFrame to make it invisible, a fixed size, and zero margins.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Mar 2009
    Brisbane, Australia
    Thanked 1,595 Times in 1,523 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows
    Wiki edits

    Default Re: Prevent a Layout in a Layout from auto-resizing

    Or QBoxLayout::setStretchFactor() with 0 for the uppermost child layout, and 1 for each of the others? Not sure if that is exposed in Qt Designer.

Similar Threads

  1. Replies: 6
    Last Post: 14th March 2018, 21:25
  2. Replies: 2
    Last Post: 2nd August 2015, 11:34
  3. Replies: 0
    Last Post: 12th December 2010, 06:09
  4. Auto Layout TreeView's item?
    By jerry7 in forum Qt Programming
    Replies: 3
    Last Post: 21st September 2010, 07:48
  5. Resizing a Layout
    By vvbkumar in forum Qt Programming
    Replies: 2
    Last Post: 21st June 2006, 09:02


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.