[PyQt] Override QStyledItemDelegate.initStyleOption not working?
phil at riverbankcomputing.com
Tue Jan 10 10:19:13 GMT 2012
On Tue, 10 Jan 2012 00:11:49 +0100, Andreas Pakulat <apaku at gmx.de> wrote:
> I'd like to customize the display of a model via a styleditemdelegate,
> in particular I want to add a decorating icon depending on some custom
> role from the model.
> As far as I can see the easiest way to do this would be overriding
> initStyleOption since then I can set the icon and icon-size directly on
> the option and leave the rest to the standard paint etc. methods.
> Unfortunately it seems this does not work in PyQt, the code is executed
> properly but the icon does not show up in the itemview. Since the
> function in C++ takes a pointer to the option-parameter I wonder wether
> this is simply not possible with PyQt or wether I need to go hunting for
> the bug elsewhere?
> Using Qt 4.7.4, sip 4.13 and PyQt 4.8.6
Are you keeping a reference to the option - if not see if this makes a
More information about the PyQt