Results 1 to 5 of 5

Thread: flowlayout label spacing issue

  1. #1
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default flowlayout label spacing issue

    Hello,

    replacing a QPubhsButton in the flowlayout example with a QLabel produces some unexpected results: the label is not vertically centred as it would be with a simple QHBoxLayout (see image of issue attached). I have tried to offset the label by adding QSize to its geometry, setting the size policy to expanding and setting the alignment to centered. But nothing did help. What am I missing? (Using 4.8.6 on CentOS 6.5)

    flowlayout.png

    Regards

    Sebastian

  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: flowlayout label spacing issue

    Could be a matter of text alignment flags.

    By why use that layout in the first place?

    Cheers,
    _

  3. #3
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: flowlayout label spacing issue

    I have set the alignment to AlignCenter but it did not help.

    I am using the layout, because I have a toolbar-like widget of checkboxes and dropdowns, which I'd like to be aligned on one row (I was using a HBoxLayout for that until now). But now the widget has grown and it also needs to work on some laptop screens, which are not that wide. So it would be nice if the widgets just go to the next line if the screen is not wide enough. Do you have a better ui design for this case?

  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: flowlayout label spacing issue

    If the alignment didn't work that might mean that the height of the label is less than the height of the button.

    Hmm, since this is a custom layout, you could try fixing the layout's behavior so that it aligns the vertical centers of each widget of a "line".

    Cheers,
    _

  5. #5
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: flowlayout label spacing issue

    You are probably right. I will try make this work by first checking all the size hints of all items in a row and then moving items with smaller size hint heights. Thanks for the help.

Similar Threads

  1. Replies: 2
    Last Post: 5th September 2013, 16:29
  2. Replies: 2
    Last Post: 30th January 2013, 16:20
  3. Replies: 6
    Last Post: 13th August 2011, 19:31
  4. What is the line spacing
    By smoozer in forum Qt Programming
    Replies: 3
    Last Post: 9th September 2009, 17:26
  5. Problem with spacing
    By ali22 in forum Qt Tools
    Replies: 1
    Last Post: 21st January 2008, 18:51

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.