[Qt-interest] changing style of a QListViewItem
Andre Somers
andre at familiesomers.nl
Wed May 26 10:13:45 CEST 2010
On 26-5-2010 9:51, Nishant Sharma wrote:
> Hi,
> On double click of a QListViewItem, I want to make that item in bold
> and underline.
> Can anyone please let me know how to do that ?
>
>
Have your model do that for you by setting the appropriate roles. If you
don't want to clutter your model with this, you could implement it in a
proxy model.
The point is that the state of an item is stored in the model, not in
the view (ok, one exception, the collapsed state). If you want to make
an item appear bold and underlined, i.e., different from other items,
than that obviously represents a different state. It therefor has to go
into the model.
If you want to do more advanced things, you have to resort to a
delegate, but in this case, you don't need it.
André
More information about the Qt-interest-old
mailing list