1
votes

I want to customise QTreeWidgetItem. I wish to add to it, two Toolbuttons and a string. Also I wish to add these to only one column in the treewidget.

I tried to subclass QTreeWidgetItem but realised I coult not "paint" on it as it is not derived from QWidget.

I then tried using QTreeWidget::setItemWidget(QTreeWidgetItem *item, int column, QWidget widget);However, the button overlaps over the text written to the item. If I add widgets to different columns, using the above call, I'm not able to acheive the look and feel the way I want to.

How do I acheive this?

Also, I want to change my "+/-"(expand collapse) buttons to triangular buttons as in Vista. I saw an example where they do it using stylesheets, but is there another way to do it through code?

Thanks

1

1 Answers

1
votes

For such an extensive modification, I would recommend changing from a tree widget to a model and tree view, and using a delegate to change how it is painted. There are a number of examples on their web site.