How to remove dotted-lines in QTreeview
-
Hi, all
I'd like to remove the "dotted-lines" in QTreeview, by dotted-lines, I mean the area in red circle of this picture.Google told me to
@treeView->setStyleSheet(QString("QTreeView::branch { border-image: none; }"));@
or re-implement
@void QTreeView::drawBranches ( QPainter * painter, const QRect & rect, const QModelIndex & index ) const@These methods kind of works, but they left the "dotted-lines" area as blank, while I want to totally remove them, i.e. the tree items will move to the left a bit and no blank area on the left side.
-
Hi,
you could derive from QTreeView and reimplement "drawBranches":http://doc.qt.nokia.com/4.7/qtreeview.html#drawBranches
You could use style sheets (see "style sheets, search for QTreeView":http://doc.qt.nokia.com/4.7/stylesheet-reference.html#list-of-stylable-widgets or the "QTreeView style example":http://doc.qt.nokia.com/4.7/stylesheet-examples.html#customizing-qtreeview )
-
"This property holds indentation of the items in the tree view":http://developer.qt.nokia.com/doc/qt-4.8/qtreeview.html#indentation-prop for manipulate blank area on the left side.