[Qt4-preview-feedback] Update item view examples to use QStyledItemDelegate
Pete Christensen
qt at graffiti.graceland.ca
Fri Feb 13 16:02:56 CET 2009
Pete Christensen wrote:
> I'm a newbie using 4.4.3 and I've noticed something in the examples
> documentation that should be updated for 4.5 if it hasn't already been
> done:
>
> From doc/html/qstyleditemdelegate.html:
>
> QStyledItemDelegate and QItemDelegate
>
> QStyledItemDelegate has taken over the job as default delegate - leaving
> QItemDelegate behind. They will now co-exist peacefully as independent
> alternatives to painting and providing editors for items in views. The
> difference between them is that the new delegate uses the current style
> to paint its items. We therefore recommend using QStyledItemDelegate as
> base when implementing custom delegates. The code required should be
> equal unless the custom delegate also wishes to use the style for drawing.
>
> However, the examples that use delegates in the "Item View" section have
> not been updated to use QStyledItemDelegate. Luckily for me there's a
> code snippet in doc/src/snippets/widgetdelegate.cpp that shows how to
> use QApplication::style()->drawControl to paint controls in the correct
> style, but the example docs just got in the way. If I had any hair to
> begin with, I'd have less now.... :)
Same in the main Model/View documentation describing Delegates:
doc/html/model-view-delegate.html
More information about the Qt4-feedback
mailing list