[Interest] Making a bunch of labels the same width?

Matthew Woehlke mwoehlke.floss at gmail.com
Mon Jun 22 20:10:09 CEST 2020

I have a custom widget that internally consists of a couple other 
widgets, including a QCheckBox, in a horizontal layout. I have another 
custom widget that provides a collection of these in a vertical layout.

I'd like to arrange for everything to line up neatly.

(Because of the hierarchy, it would require non-trivial refactoring to 
use a grid layout instead of nested layouts. Also, the 'sub'-widget is 
meant to be usable in other contexts that might not have a parent 
layout, or would have some other layout.)

My offhand idea is to set a minimum size on the QCheckBoxes, but I'm not 
sure how to go about getting the minimum size (since it isn't computed 
yet at the "obvious" points to ask for it).

Is there an easy way to make the labels (QCheckBoxes) the same width?


More information about the Interest mailing list