Search code examples
macosqtmacos-sierra

QComboBox display height in macOS


I have a QComboBox that I want to display both icons and text. As such, I need to set the height of the combo box to be at least the height of the icons - I was thinking around 32px, but that is flexible. Unfortunately, under macOS 10.12 at least (pretty sure I've had the same problem on older releases as well, however), I can't seem to change the height of the combo box at all, with the result that the icon of the currently selected item overflows the combobox display.

I've tried both setting the stylesheet for QComboBox to add a height attribute, as well as setting the minimumSize height property on the widget itself, but unfortunately the only effect so far has been to add space around the combo box - as though it is larger, even though it isn't. How can I get the combo box height to change on macOS? Thanks.


Solution

  • The native combo box on OS X doesn't support this :( Qt's mac style could support it, making it look less-native, but alas it doesn't. You must either make your icons smaller, or restyle the combo from scratch to approximate how an imaginary upsized native combo would look.