PDA

View Full Version : How to prevent QTreeView::item border styles from ruining item selected style?



pmjobin
25th January 2015, 04:23
I'm creating a property editor widget based on a QTreeView and would like to add horizontal/vertical lines to separate rows and columns. I attempted to set the following stylesheet on the QTreeView:


QTreeView:item {
border-right: 1px solid #d9d9d9;
border-bottom: 1px solid #d9d9d9;
}
QTreeView::branch {
border-bottom: 1px solid #d9d9d9;
}

The grid appears as expected but selected items aren't highlighted in blue anymore. Furthermore, the [+] symbol to expand a group appears to be gone.

Before:

10901

After:

10902

If there is any method other than setting the stylesheet to achieve the same result, I'd be glad to hear about them. I tried the QStyledItemDelegate method but unfortunately, the horizontal lines do not cover the "branch" region.

Thanks for your help.