[PyQt] Bug: QComboBox popup doesn't account for different font sizes

Nathan Weston nathan at genarts.com
Mon Sep 12 22:24:55 BST 2011

If I create a QComboBox, use a stylesheet to increase or decrease the 
font size, and put it within a QGridLayout, then the popup menu of the 
combo box draws incorrectly.

With smaller fonts, it's too small vertically, and even if there are 
only 2-3 items, the last item is cut off and a vertical scrollbar 
appears. With larger fonts, the popup is tall enough but the items 
overlap each other, leaving empty space at the bottom. Only 14px fonts 
seem to work correctly.

I'm using Qt 4.7.3 and PyQt 4.7.2. The problem occurs on Windows and 
Mac, but not Linux (though I may have different versions installed 
there, I didn't have a chance to check).

Attached is a small program which demonstrates the problem.

I imagine this is really a Qt bug, but I don't do Qt C++ development so 
I haven't had a chance to test it in that environment.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: combobox-bug.py
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110912/fd4f026d/attachment.ksh>

More information about the PyQt mailing list