Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set line between qtreewidget items

Tags:

c++

qt

I have a QTreeWidget that items append to it dynamically, I want to set lines between them, I have first pictures and I want it to be like the second one, but I don't know how doing it? thank you in advance!

[I have this tree

[I want my tree to be like this

like image 237
mari Avatar asked Sep 07 '25 16:09

mari


1 Answers

Well you can experiment with stylesheets:

treeWidget->setStyleSheet("QTreeWidget::item { border-bottom: 1px solid black;}");

But I am not sure if can get exactly the look you want. You can also subclass QStyledItemDelegate and provide your own sizeHint() and paint() implementations.

like image 138
Johny Avatar answered Sep 10 '25 07:09

Johny