Hi Ruan, 

 

In our global style sheet we use: 

 

QTreeView {

                background-color: transparent;

                selection-background-color: green; /* Used on Mac */

                selection-color: white; /* Used on Mac */

                show-decoration-selected: 1;

}

QTreeView::item {

                background-color: transparent;

}

QTreeView::item:selected {

                background-color: green; /* Used on Windows */

                color: white;

}

QTreeView::item:disabled:selected {

                background-color: #e0e0e0;

                color: black;

}

 

Hope that helps! 

 

Tony

 

 

From: Interest [mailto:interest-boun...@qt-project.org] On Behalf Of Ruan leitão
Sent: Wednesday, 30 December 2015 2:31 AM
To: interest@qt-project.org
Subject: [Interest] [qt-4.8 windows] Setting QTreeView selected item style in 
qss

 

Hello, 

I already have post this question in Stack Overflow 
<http://stackoverflow.com/questions/34187874/setting-qtreeview-selected-item-style-in-qss>
 , but a have no answer. Now a friend tell me to talk on the mailing list.

 

I need to change the background color of the selected item on a QTreeView. I 
already tried using the Qt examples and other SO questions.

The style applied to the ::branch subcontrol works fine, but none of the 
commands in the ::item subcontrols works.

Here my current result:

 <http://i.stack.imgur.com/kQyGk.png> Image removed by sender. enter image 
description here

But I want a result like this:

 <http://i.stack.imgur.com/TjucU.png> Image removed by sender. enter image 
description here

Can someone help me, thanks in advance.

Ruan L. Nunes

-- 

Ruan L. Nunes

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to