Thomas Koschel
Thomas Koschel

Reputation: 3361

Custom style with Qt

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) ...

Upvotes: 5

Views: 6182

Answers (5)

Colin Jensen
Colin Jensen

Reputation: 3809

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.

Upvotes: 7

Caleb Huitt - cjhuitt
Caleb Huitt - cjhuitt

Reputation: 14941

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.

Upvotes: 3

David Boddie
David Boddie

Reputation: 1046

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

         http://doc.qt.digia.com/4.4/stylesheet.html

Upvotes: 0

Kena
Kena

Reputation: 6921

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.

Upvotes: 1

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.

Upvotes: 1

Related Questions