Custom style with Qt

Does anyone have any experience creating custom styles in Qt? What I have in mind is a completely new style that affects all kinds of widgets. I saw several examples on the web for a custom combo box. But I have no idea how much time and code it takes to create a “complete” new custom style ... maybe someone can give me a hint.

We are thinking about using Qt 4.3 (or even newer) ...

+4
source share
5 answers

I developed a “new” style that changed the look of most of the application. It took some time and quite a lot of experiments. I also got my style from the universal Windows style so that it can handle some things that I did not want to communicate with. All of the above, I think it took me a week to get most of what I wanted, with almost no prior impact on the styles.

In order to actually develop it, I would fall into the source for my examples of styles , which has a "wooden" style. I put my own style in place of the sample style and started changing things using the sample program to check how it looks. Depending on how you develop it, you may want to have a configuration file so that you can easily change some values ​​without recompiling.

+3
source

Check out the Stylesheets object in Qt 4. Although this is still a problem, it's easier than doing a full custom style. You can simply customize one visual facet at a time and try it.

He pays attention to inheritance. Therefore, if you create a font in a QWidget, each visual widget will also use that font. And so on.

+7
source

We did this in the past (in Qt 3), and it is very time consuming. We had a lot of problems with flickering, redraws did not work as we expected, sluggish behavior, errors in the implementation of Qt. It's a lot less straightforward than it sounds, and little support or user experience too. If you do not need something really specific (as we did), I would say that this is not a problem.

It is supposed that other frameworks will simplify (are some of them based on Java?), But I have no first experience.

+1
source

You can look at existing styles. You can find many of them at kde-look.org, in the Styles / 4.0 section.

+1
source

If you don’t need to radically change the widget's style, you can try using widget style sheets:

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

Source: https://habr.com/ru/post/1276713/


All Articles