PDA

View Full Version : customizing QScrollbar



MarkoSan
30th May 2008, 17:34
Hi to all!

I subclassed QScrollBar but now I have two questions:


How do I repaint slider with some texture (I've made texture using photoshop and converted it to .png file)
How do I repaint both arrows with custom shape/custom picture?

Is it right way to reimplement paintEvent()?

jpn
30th May 2008, 17:53
The answer is: don't subclass but use style sheets. :)

MarkoSan
30th May 2008, 18:17
Ok, but I want to do it hard way!!!!!

jpn
30th May 2008, 18:25
Ok, but I want to do it hard way!!!!!
Well, good luck. Take a look at QScrollBar::paintEvent() implementation. It's all done with styles. You might be able to change the background brush with palettes but for custom arrow controls you'll need a custom style. At least if you want to do it the right way (tm).

metdos
15th October 2009, 10:52
The answer is: don't subclass but use style sheets. :)

I used style sheet, but it does not look very good, and also examples in qt documentation don't seem enough. http://doc.trolltech.com/4.4/stylesheet-examples.html#customizing-qscrollbar

Do you have any good examples of style sheet applied on QScroolBar?

Thanks.

axeljaeger
15th October 2009, 16:26
Do it using a QStyle, it is hard enough.

metdos
15th October 2009, 19:48
Do it using a QStyle, it is hard enough.

Do you have any suggestion for changing the appearance of QScrollBar?

axeljaeger
15th October 2009, 19:51
Reimplement drawComplexControl and watch out for CC_ScrollBar