PDA

View Full Version : Reimplementing a Widgets Look



Stobie
7th January 2010, 01:33
Hi
I'm making an application for a small black and white screen and need to change the appearance of the scroll bar in a listwidget. If I reimplement QScrollbar and modify its paint event is there a way to make the list widget use this reimplemented scrollbar? Or is there a better way of achieving this?
Thanks

aamer4yu
7th January 2010, 05:24
If I reimplement QScrollbar and modify its paint event is there a way to make the list widget use this reimplemented scrollbar?
Why not ? It will be a new widget and you can use it.

Or is there a better way of achieving this?
Try stylesheets. It will be easier. You can get examples from the docs under Qt StyleSheets

axeljaeger
8th January 2010, 11:57
Subclass QStyle and set the new style in your QApplication using QApplication::setStyle.

Stobie
10th January 2010, 21:46
thanks guys, I got it to look the way I wanted using style sheets. I'm using a stripped down version of Qt though and when I try to make it there it says QApplication has no member named setStyleSheet(). Do you know what needs to be included when configuring Qt to include setStyleSheet() ?

axeljaeger
10th January 2010, 22:08
There is definitely such a method in QApplication.

Stobie
10th January 2010, 22:23
Don't worry, I got it. When I was configuring I added -no-scripttools which meant qapplication didnt have the method. I reconfigured without that option and It's fine now. Thanks again for your help.

axeljaeger
10th January 2010, 22:37
-no-scripttools should have nothing to do with stylesheets. Scripttools are the debugger for the QScript-engine.

Stobie
11th January 2010, 01:38
Ok, I think I made a mistake and actually included everything when I thought I just removed -no-scriptools because somehow the qconfig file I was using had all of its content deleted. There is something I'm not including in the configuration though which means I can't use setStyleSheet, do you have any idea what that might be?

axeljaeger
11th January 2010, 10:10
From the header of QApplication, I see that there is a define:
QT_NO_STYLE_STYLESHEET