PDA

View Full Version : QScrollbar color



ntp
28th August 2008, 18:59
This is Qt4.4.1.

This is a follow-up in a way to my previous thread:
http://www.qtcentre.org/forum/showthread.php?t=15419&goto=newpost

I discovered that my way to try and set the colors on the whole dialog was incorrect and caused problems for QScrollbar. I was told that the way to do this is through style sheets.

I followed the example given in the style sheet example [/URL][url]http://doc.trolltech.com/4.4/stylesheet-examples.html#customizing-qscrollbar (http://doc.trolltech.com/4.4/stylesheet-examples.html#customizing-qscrollbar) but then I lose the nice buttons, the ability for the buttons to appear pressed (I tried giving a set of colors to QScrollBar::up-arrow:vertical:clicked but that didn't do anything), etc. The downside of using the style sheet is that, as it states in the documentation:

Note that if one property or sub-control is customized, all the other properties or sub-controls must be customized as well. I have fiddle with it to get it closer to a "standard" scrollbar but it's still not like the default one and closer to the one pictured in the example doc.

I am wondering if I have to instead subclass the QScrollBar and QScrollBarHandle and do all the painting myself which I would like to avoid.

Does anyone have a simple way to do this? I tried doing a search in here and through the trolltech lab site and didn't find what I was looking for. I really want to keep the look and feel of the default widget style but just have a new color.

Thanks.