Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Can I Customize QTreeView this way?
leonidwang last edited by
I've built a model for QTreeView, now it's time to customize QTreeView, to display items in a "fancy" way.
For example, I'd like each tree item looks like this:
Basically, I want a icon on the left, some texts of different font sizes, a progress bar...
When double clicked the parent item(i.e. expanding treeview), child items will be displayed in similar way.
I don't know how to render items in the way I wanted, what's worse, I'm not sure where to get started.
I've tried a very simple QItemDelegate from the Qt SDK examples, but it is not enough.
Any suggestion, reference link will be appreciated, thanks.
dangelog last edited by
Yes, a delegate is definitely what you want. Subclass QStyledItemDelegate and do your custom painting there.