Results 1 to 4 of 4

Thread: Simple layout problem

  1. #1
    Join Date
    Aug 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Simple layout problem

    Hello,
    got some small problem with layout on widgets.
    I know it's probably is very simple, but I couldn't find right answer.

    example.jpg

    How to stretch those buttons on whole surface of parent widget and keep them in the same sizes?

    Anyone knows?

    BR
    Tomek

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Simple layout problem

    If you are adding them in code, pass the same non-zero value to the stretch argument of the layout's addWidget() call.
    If you are adding them in designer, change the size policy to Expanding or MinimumExpanding

    Cheers,
    _

  3. #3
    Join Date
    Aug 2012
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Simple layout problem

    Hi,
    it doesn't work, because I already add them from the cod with non-zero value and is the same situation when i put 1 for all or 100 for all.

    this->hboxBottomMenu->addWidget(newd,1,Qt::AlignHCenter);


    Added after 19 minutes:


    My bad. When I deleted Qt::AlignHCenter it looks much better, but still i got some gaps between buttons ;/
    Last edited by Kaluss; 27th July 2014 at 11:07.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Simple layout problem

    Gaps between child widgets could be a matter of the layout's spacing. See QLayout::setSpacing().

    Cheers,
    _

Similar Threads

  1. simple problem, not sure what I did:
    By ABZB in forum Newbie
    Replies: 7
    Last Post: 13th May 2013, 15:02
  2. Simple problem with layout
    By damon_1990 in forum Newbie
    Replies: 2
    Last Post: 17th October 2011, 23:02
  3. problem in simple example for installEventFilter
    By navid in forum Qt Programming
    Replies: 2
    Last Post: 10th December 2009, 19:43
  4. Simple problem
    By s410i in forum Qt Programming
    Replies: 3
    Last Post: 22nd June 2008, 11:12
  5. simple thread layout question
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 12th August 2006, 11:02

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.