tags:

views:

1664

answers:

5

Has anybody experience in building a custom style in Qt? What I have in my mind is a complete new style that affects all kind of widgets. I have seen some examples in the web for a custom combo box. But I have no idea how much time and code it takes to build a "complete" new custom style ... maybe someone can give me a hint.

We think of using Qt 4.3 (or even newer) ...

+1  A: 

We've done it in the past (in Qt 3), and it's extremely time-consuming. We had a lot of problems with flickering, redraws not working the way we expected, sluggish behavior, bugs in the Qt implementation. It a lot less straight-forward than it seems, and there's little support or user experience too. Unless you need something really particular (as we did), I'd say it's not worth the trouble.

Other frameworks are supposed to make it easier (some Java-based?), but I don't have first hand experience.

Kena
Which qt version have you been working with?
koschi
+2  A: 

Check out the Stylesheets facility in Qt 4. While it's still a hassle, it's way easier than doing a full-on custom style. You can just adjust one visual facet at a time and try it out.

It pays attention to inheritance. So if you style the font in QWidget, then every visual widget will also use that font. And so on.

Colin Jensen
Hi Colin, so have you already been developing a new style with Qt 4? Can you give me a hint how much time it took you?
koschi
A: 

You might want to look at existing styles. You can find quite a few of them on kde-look.org, in the Styles / 4.0 section.

agateau
+1  A: 

I have developed a "new" style that changed the appearance of much of an application. It did take some time, and quite a bit of experimentation. I also derived my style from the generic windows style, to allow it to handle some of the stuff I didn't want to mess with. All told, I think it took me a week to get most of what I wanted, with practically no prior exposure to the styles.

In order to actually develop one, I would get into the source for their styles example, which has a "wood" style. I put my own style in place of the example style, and started changing things while using the example program to check how it looked. Depending on how you are developing it, you might want to have a configuration file so you can easily change some of the values without recompiling.

Caleb Huitt - cjhuitt
A: 

If you don't need to radically change the widget style, you might want to try using widget style sheets:

http://doc.trolltech.com/4.4/stylesheet.html

David Boddie