[Qt-jambi-interest] BackgroundRole

Gunnar Sletta gunnar at trolltech.com
Wed Feb 11 12:01:05 CET 2009


Vincent Lebreil wrote:
> Ok me again :)
> 
> I found it: QApplication.setStyle(String)
> 
> Then i got allowed styles with QStyleFactory.keys(): [Windows, 
> WindowsXP, WindowsVista, Motif, CDE, Plastique, Cleanlooks]
> 
> So i tried with some of them:
> 
> It works with the following styles: Windows, WindowsXP
> but not with: WindowsVista
> 
> Do you know why ?

I suspected this earlier on, but forgot to check vista so I missed it. 
The problem is really that the style has "final say" in the background 
in the default item delegate. All other styles will respect the 
BackgroundRole, but the vista style overrides it. This is because vista 
tree backgrounds need some special handling to be compatible with native 
look and feel.

In this case, you can override the default behaviour by subclassing 
QItemDelegate and reimplement one of the paint functions, for instance 
drawBackground().

best regards,
Gunnar



More information about the Qt-jambi-interest mailing list