[Interest] [qt-4.8 windows] Setting QTreeView selected item style in qss

Tony Rietwyk tony at rightsoft.com.au
Tue Dec 29 16:57:43 CET 2015


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-bounces at qt-project.org] On Behalf Of Ruan leitão
Sent: Wednesday, 30 December 2015 2:31 AM
To: interest at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151230/0f064569/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ~WRD000.jpg
Type: image/jpeg
Size: 823 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151230/0f064569/attachment.jpg>


More information about the Interest mailing list