[PyQt] strange extra spacing between checkboxes

Shriramana Sharma samjnaa at gmail.com
Tue Nov 20 07:20:43 GMT 2007


Mark Summerfield wrote:

> height = QFontMetrics(window.font()).height()
>         checkboxes[i].setMaximumHeight(height)
>         checkboxes[i].setMinimumHeight(height)

Thanks. Adding these lines corrected the problem.

> Note that this might fail, for example if the font is changed
> dynamically. 

Do you mean that if the font size is changed (or the font changes and 
the font carries a different size hint) then the virtually-hardcoded 
size of the checkboxes might mean that the text is cropped? If yes, then 
it should be trivial to add lines to update the min and max heights if 
the font is changed, no?

> It also means that the minimum size of the widget becomes
> fixed (10 * (height + (2 * margin))).

That's not a problem, is it? Or could it be?

Shriramana Sharma.


More information about the PyQt mailing list