1 Attachment(s)
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)
Attachment 10544
Regards
Sebastian
Re: flowlayout label spacing issue
Could be a matter of text alignment flags.
By why use that layout in the first place?
Cheers,
_
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?
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,
_
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.