[Qt-interest] QTreeWidget->setItemWidget() works contrary to Qt documentation

Roland Tollenaar rwatollenaar at gmail.com
Sat Oct 8 15:16:00 CEST 2011


Hi,

The documentation of Qt4.5.2 on QTreeWidgetItem::setItemWidget(..) reads:

"Sets the given widget to be displayed in the cell specified by the 
given item and column.

This function should only be used to display static content in the place 
of a tree widget item. If you want to display custom dynamic content or 
implement a custom editor widget, use QTreeView and subclass 
QItemDelegate instead."

We have been adding Qlineedits and QtextEdits for editing to 
QtreeWidgetItems for years without problems.

Spotting this now there is a concern that future versions of Qt (we 
might have to upgrade at some point) will break our code.

Can anyone comment on this?

Kind regards,

Roland








More information about the Qt-interest-old mailing list