[Qt-interest] QLayout: Aligning elements with some elements outside and some elements inside of a widget

John McClurkin jwm at nei.nih.gov
Fri Dec 3 13:38:42 CET 2010


micu wrote:
> Hi there, 
> 
> I am new to this list and new to Qt --- so please excuse me, if my 
> questions are a bit stupid ;).
> 
> I created a custom widget, which includes a name in a title bar, some 
> connector names (QLabels), and some connector icons (I took radio 
> buttons in this case). These connector names are inside of a QFrame, 
> while the connector icons are outside of the QFrame --- see attached 
> picture.
> 
> Now I want those connector icons to be aligned horizontally with the 
> corresponding connector names (QLabels). I achieved a similar result 
> with a workaround with QLayouts (see attached picture), but the 
> alignment isn't perfect, as the frame of the QFrame takes a bit of the 
> place.
> 
> Is there any (preferable, "Qt-like") way of doing this that results in 
> perfect alignment of connector name labels and connector icons? More 
> generally asked: Is there a way of aligning widgets/layouts within 
> another widget and widgets/layouts outside of that widget?
> 
> Kind regards,
> micu
> 
> 
> ------------------------------------------------------------------------
> 
Why not put each connector icon with the corresponding label in a 
horizontal layout, then put the horizontal layouts in a vertical layout?



More information about the Qt-interest-old mailing list