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
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
QTreeWidgetItems have the property childIndicatorPolicy. The allowed values are:
You want the first one.
theItem.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator)
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