Reputation: 415
How to make expandable sign in QTreeWidget always visible even when item doest have any subitems? And how to draw something else instead of default sign?
Thanks in advance, Serge
Upvotes: 6
Views: 9105
Reputation: 415
Answering on my second part of question for others.
I looked for drawing functions in QTreeView and found following:
void QTreeView::drawBranches ( QPainter * painter, const QRect & rect, const QModelIndex & index )
With this function you can draw whatever you want at the left side of each item.
And another good choice to hanlde this - use Style Sheets for QTreeView:
http://qt.nokia.com/doc/4.6/stylesheet-examples.html#customizing-qtreeview
Upvotes: 8
Reputation: 126095
QTreeWidgetItems have the property childIndicatorPolicy. The allowed values are:
You want the first one.
theItem.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
Upvotes: 9