View Full Version : QTreeWidget + StyleSheet problem

21st December 2009, 10:42
Currently I'm working on a multi column TreeWidget, with a custom highlight style set with style sheets.

QTreeWidget::item:hover {
border: 2px solid #fff;
QTreeWidget::item:selected {
border: 2px solid #fff;

Problem is, that the style is applied to all colums of a row, each cell got a border. But I only want to whole row to be bordered, not each row cell.

Does anybody have an idea how to achieve this with style sheets? Or do I have to use a custom ItemDelegate for this?

Edit: Forgot to mention: Each row is a single QTreeWidgetItem, while each column is simply set with SetText(0,...), SetText(1,...)...

21st December 2009, 21:16
There doesn't seem to be a subcontrol for a whole row. But a delegate that just draws the boxes really isn't much work. Just reimplement the paint Method, let the standard paint method do most of the work and draw that lines as needed