PDA

View Full Version : How to remove the dot line in QTreeWidget?



cspp
14th May 2009, 09:06
I use the QTreeWidgt like this:


QTreeWidget* pShowListView = new QTreeWidget;
QTreeWidgetItem* item = NULL;
QTreeWidgetItem* preItem = NULL;
for( ...; ...; ....)
{
item = new QTreeWidgetItem(pShowListView,preItem);
//init the item value

preItem = item;
}


then how can I remove the line in my Treewidget?
the line like this:

|__My Record A
|__My Record B
|__My Record C
|__My Record D

aamer4yu
14th May 2009, 09:33
If you only have top level items in the tree, using QTreeView::setRootIsDecorated(false) will do the trick.

If you have many levels, then you might need delegates or styleSheets...