[Qt-interest] Using stylesheet properties for QTreeView items

Ruben Vandamme vandammeru at gmail.com
Fri Jul 31 21:39:35 CEST 2009


Hi all

I'm currently making an application themeable using Qt stylesheets. I'm 
using Q_PROPERTIES to add extra parameters/options. For "normal" widgets 
it's simple and documented (see 
http://doc.trolltech.com/4.5/stylesheet-syntax.html).

However, for Model based views (like the QTreeView) it's not so obvious 
on how to do it (for the items). I'd like to do the following things in 
the stylesheets:

QTreeView::item[negativeValue="true"] {
  background: red;
}

QTreeView::item {
  qproperty-foobar: 20;
}

Now, the big question is where do I need to add the needed QProperties? 
After a lengthy google session, I couldn't find any example (or 
documentation). Can someone say how to do it (or give an example)? 
(maybe it's even not possible)


Thanks in advance
Ruben



More information about the Qt-interest-old mailing list