[PyQt] question about QComboBox

Damon Lynch damonlynch at gmail.com
Fri Apr 8 06:51:37 BST 2016


On Fri, Apr 8, 2016 at 10:04 AM, Phillip Feldman <
phillip.m.feldman at gmail.com> wrote:

> My question was badly worded.  The PyQt4/PySide documentation for
> QComboBox does show a setStyleSheet method for the top-level widget, and
> this works just fine, but it looks as though there is nothing comparable
> for the individual combobox options.
>

Setting a style sheet on a combobox can have surprising consequences for
the visual appearance of the drop down list. In fact the drop down list can
end up looking strikingly different to what you might expect -- and
depending on your taste, not in a good way.

The best solution I'm aware of is to use a delegate:

comboboxDelegate = QStyledItemDelegate()
combobox.setItemDelegate(comboboxDelegate)

Applying a style sheet to the delegate might solve your problem too.

Damon

-- 
http://www.damonlynch.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160408/fc62c452/attachment.html>


More information about the PyQt mailing list