PDA

View Full Version : frame around the tree widget items



fulbay
29th December 2010, 14:21
Hello all,

Is it possible to draw frames around each tree widget items? I could not find any way to handle this :(

Thanks in advance for your help...

aamer4yu
29th December 2010, 14:29
Frames as in ? rect on the boudary ?
Sure... use delegates. Have a look at QItemDelegate and QStyledItemDelegate

fulbay
29th December 2010, 14:33
Borders between each tree widget item in a tree widget (QTreeWidget).

Which widget should I delegate? It is not very clear to me. I have used delegated items just to put another type of widget on a column in the tree. How should I use this kind of implementation to make frames around the tree widget items?

Thanks a lot...

aamer4yu
29th December 2010, 14:37
You just need to override the paint function of delegate.
Call the base class paint function, and after that draw the rect as a boundary,