PDA

View Full Version : How to do this with StyleSheet



yxmaomao
29th May 2008, 09:48
hi guys

You know in the QTreeView, for the selected item's background color, they are two types:
1. when QTreeView get focus
2. when QTreeView lose focus

in this two cases, they are different colors

Now my problem is: how to modify these two colors with stylesheet

Thanks in advance

mazurekwrc
29th May 2008, 10:05
use this

QTreeView::item:selected:active
{
background: green;
}

QTreeView::item:selected:!active
{
background: yellow;
}

yxmaomao
30th May 2008, 00:07
Sorry, it doesn't work
Are you sure?

sgh
30th May 2008, 02:48
reference docs.
here is http://doc.trolltech.com/4.3/stylesheet-reference.htmldoc.

mazurekwrc
30th May 2008, 07:11
yes I'm sure, but I look to docs and it has been added it in qt 4.4 so maybe here is problem that its won't work to you

yxmaomao
30th May 2008, 08:54
Yes , I confirmed , :active is Qt 4.4's property, not for Qt 4.3 ,
it is a pity I am using Qt4.3 and must use this version
How to do it in Qt4.3?