[Qt-interest] changing style of a QListViewItem

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Wed May 26 10:40:33 CEST 2010


>
> How will setting a role change the appearance of the selected text?
> Wouldn't  a custom delegate be needed anyway?
>
> IMHO, bold and underlined is just a different way of showing the
> "selected" state, so that should be the job of a delegate. CMIIW.
>
>
> If the OP wanted to display the selected state, you are right. You need a
> delegate (or a different style). But double clicking isn't changing the
> selected state, in my book. However, I may have misunderstood.
>
> You can change the font by using QAbstractItemModel::data and returning
> something sensible for the Qt::FontRole. You can als modify colors

Ah yes...the Qt::FontRole. Had forgotten about that!

I guess this approach should be used if we always want to show the
models data in the same manner, no matter what view is being used
(provided the view doesn't override it with its delegate). If the OP
wants that, then I guess this is way to do it.

Thanks,
-mandeep


> (foreground and background) and alignment this way, along with some other
> properties.
>
> André
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>




More information about the Qt-interest-old mailing list