Cenoc
Cenoc

Reputation: 11682

Image or text in between items in QTreeWidget

I was wondering what would be the way to put an image or a little bit of text between items in QTreeWidget. In particular, I would like to have 'OR' and 'AND' show up, to indicate a query structure... is this possible. Any advice would be very much appreciated! Preferably, I was hoping for a pyqt solution.

Upvotes: 0

Views: 244

Answers (1)

three_pineapples
three_pineapples

Reputation: 11869

The only way I can think to do this would be to insert another QTreeWidget item in-between the items at the location you want the text to appear. QTreeWidgetItem has some methods like setDisabled(), etc. which would allow you to customise the item so it wasn't selectable, had a different colour, or whatever you wanted.

If that isn't good enough, I think you would have to do down the route of changing how the widget is painted, and that will not be easy.

Upvotes: 1

Related Questions