Results 1 to 2 of 2

Thread: Zero-size expanding Spacer, some way to top align in a group-box

  1. #1
    Join Date
    Aug 2010
    Location
    Germany
    Posts
    54
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Angry Zero-size expanding Spacer, some way to top align in a group-box

    I have a layout like this:
    Qt Code:
    1. Widget (Vertical)
    2. -Box (Horizontal)
    3. --Some Group Boxes (Vertical/Grid)
    4. ---labels, radio, edits
    5. -Box (Horizontal)
    To copy to clipboard, switch view to plain text mode 

    I want all the items in the group boxes to the be top-aligned. The most obvious solution is to add a spacer at the bottom of each of them, but this increases the size of the group boxes. The QTableWidget is supposed to take all available extra space, and the other items the minimum available space.

    Is there any combination of flags/spacers/layouts I can use to get the items in the group boxes top-aligned without increase the size of those boxes?

  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: Zero-size expanding Spacer, some way to top align in a group-box

    Ok, What you expect is the default behaviour, you just need take of one thing.

    If using QtCreator to design the form, make sure that all the Container Widget's Layouts are set to QGridWidget (or at least the top level), this can be done by right click on the top level container Widget and Lay out >> Lay out in a Grid Ctrl+G

    If Using Custom code to generate the form, make sure the atleast the top level (which contains the QTableWidget) has QGridLayout() or QVBoxLayout, which ever is relavent to you.

    I have created a sample using QtCreator, it should be simple if already have hands on with QtDesigner.

    Layout.jpg

Similar Threads

  1. QTabWidget align
    By AlexD in forum Qt Programming
    Replies: 6
    Last Post: 10th August 2012, 13:19
  2. Question about align
    By Archa4 in forum Newbie
    Replies: 4
    Last Post: 14th March 2011, 08:36
  3. Expanding QToolButton size
    By kodiak in forum Qt Programming
    Replies: 2
    Last Post: 4th June 2009, 07:17
  4. Replies: 2
    Last Post: 22nd September 2008, 09:22
  5. Designer: Spacer doesn't do what I want...
    By jochen_r in forum Qt Tools
    Replies: 3
    Last Post: 19th January 2006, 05:23

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.