[PyQt] QStyledItemDelegate option properties?
thomson.eric at gmail.com
Sun Dec 13 17:55:51 GMT 2015
> In Qt 4.8.6/PyQt 4.10.4, I am reimplementing the `paint` method in a
> `QStyledItemDelegate`, just to help myself understand the default
> mechanics of tree views.
> The second input to the `paint` method is `option`, a
> `QStyleOptionViewItem`, which is supposed to be an instance of
> Such objects are supposed to contain information about the three main
> subelements of an item in a view: the text, icon, and checkstate.
> However, whenever I try to access the text (using option.text) I
> always get an empty string. That is, option seems to be incomplete.
> When I print option.version, it returns 4, so the typing seems right.
> Am I misreading what option.text is supposed to be? The index has the
> data, so I typically just pull it from there when I reimplement paint,
> but I'm wondering what is going on under the hood.
Just to make it more clear, I've attached a SSCCE with a table view
that illustrates the behavior (optionDelegatePyqt.py).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1349 bytes
Desc: not available
More information about the PyQt