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

Ruan leitão ruanrln at gmail.com
Tue Dec 29 21:34:30 CET 2015


It worked like a charm, thanks.

Maybe you can answer me two things about your stylesheet:


   - where can I find documentation about the QTreeView style specific to
   windows or mac?
   - I'm working on a windows machine, but the code that worked is the Mac
   one, do you have any idea why?


Thanks,
Ruan L. Nunes

Em ter, 29 de dez de 2015 às 13:58, Tony Rietwyk <tony at rightsoft.com.au>
escreveu:

> 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: ~WRD000.jpg]
>
> But I want a result like this:
>
> <http://i.stack.imgur.com/TjucU.png>
> [image: ~WRD000.jpg]
>
> Can someone help me, thanks in advance.
>
> Ruan L. Nunes
>
> --
>
> Ruan L. Nunes
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-- 
Ruan L. Nunes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151229/5b4e8ff9/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/20151229/5b4e8ff9/attachment.jpg>


More information about the Interest mailing list