Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt and UI Skinning

Tags:

qt

I wanted to consult with the sages here regarding Qt and skinning, get your opinion and chart a path for my development. My requirements are as follows:

  1. My Qt/C++ application (cross platform with Mac, Windows and Linux versions) needs to have modular skins.

  2. A skin is defined as a set of one or more elements: - Window background texture - Look/feel of UI controls such as edit boxes, drop down, radio buttons, buttons etc. - Look/feel of window "caption", resize grips etc.

  3. Skins will be installed with the application installer, allowing the user to choose which one he/she wants to use. Users should be able to change skins on the fly.

Can I go the QML route? should this be custom and based on simple resources which are built into the application? Any design advice will be appreciated.

Thanks.

like image 495
JasonGenX Avatar asked Jan 21 '11 19:01

JasonGenX


1 Answers

If I understood you correctly then stylesheet is the best way forward. You can create stylesheets similar to CSS and then pass them as command line option to your application or load on invocation to style your application at runtime. That way you can create multiple stylesheets each having a different look and feel and allow user to load them at will. Since its CSS it doesn't need any new learning and you can keep all your styling outside your source code.

Here are a list of resources that can get you up and running quickly:

http://blog.qt.io/blog/2007/11/27/theming-qt-for-fun-and-profit/

http://doc.qt.io/qt-5/stylesheet.html

like image 56
Pankaj Avatar answered Nov 15 '22 08:11

Pankaj