
Originally Posted by
wysota
It's a matter of widget style used and not a matter of code. If you want, you can of course draw the nodes and branches the way you want by subclassing
QTreeView and reimplementing relevant virtual methods.
thanks!
well, I changed the stylesheets as in QT Reference says, but nothing happened. Should I have the images "branch-more.png" already installed by default ? Or do I have to download them? I searchd for *branch* file names inside QT installation directory and didn't find any. How can I debug what is happening when stylesheets don't work as expected?
this is the code I added:
deptree->setStyleSheet("QTreeView::branch:has-siblings:!adjoins-item { border-image: url(vline.png) 0; }");
deptree->setStyleSheet("QTreeView::branch:has-siblings:adjoins-item { border-image: url(branch-more.png) 0;}");
deptree->setStyleSheet("QTreeView::branch:!has-children:!has-siblings:adjoins-item { border-image: url(branch-end.png) 0;}");
deptree->setStyleSheet("QTreeView::branch:has-children:!has-siblings:closed,");
deptree->setStyleSheet("QTreeView::branch:closed:has-children:has-siblings { border-image: none; image: url(branch-closed.png); }");
deptree->setStyleSheet("QTreeView::branch:open:has-children:!has-siblings,");
deptree->setStyleSheet("QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(branch-open.png); }");
deptree->setStyleSheet("QTreeView::branch:has-siblings:!adjoins-item { border-image: url(vline.png) 0; }");
deptree->setStyleSheet("QTreeView::branch:has-siblings:adjoins-item { border-image: url(branch-more.png) 0;}");
deptree->setStyleSheet("QTreeView::branch:!has-children:!has-siblings:adjoins-item { border-image: url(branch-end.png) 0;}");
deptree->setStyleSheet("QTreeView::branch:has-children:!has-siblings:closed,");
deptree->setStyleSheet("QTreeView::branch:closed:has-children:has-siblings { border-image: none; image: url(branch-closed.png); }");
deptree->setStyleSheet("QTreeView::branch:open:has-children:!has-siblings,");
deptree->setStyleSheet("QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(branch-open.png); }");
To copy to clipboard, switch view to plain text mode
Bookmarks