Results 1 to 2 of 2

Thread: Layout not giving space equally

  1. #1
    Join Date
    Feb 2008
    Posts
    40
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Layout not giving space equally

    I would like a box layout not to give all widgets the same amout of space, but for example give one 40% and the other 60%. Is it easily achievable? I browsed the classes, but found no methods providing this functionality, but maybe there are some easy ways to do this?

  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: Layout not giving space equally

    Yes, it's very simple. You want to change QSizePolicy::horizontalStretch() or QSizePolicy::verticalStretch() of widgets (they are also available in Designer if you use it). If you want 40/60 then set one widget's stretch to 2 and the other one's to 3 (or 4 and 6 or 40 and 60, I'm sure you get the point).

Similar Threads

  1. Qt layout space + stretch
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 20th December 2007, 15:53
  2. linking user space and kernel space programs with qmake
    By zielchri in forum Qt Programming
    Replies: 9
    Last Post: 8th March 2006, 23:11

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.