Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Custom GUI appearance
When developing a GUI for Windows CE I first made a GUI on my desktop utilizing Windows XP. I understood that the GUI would take on the native appearance of the OS that it runs on, but the Windows CE environment is not very attractive. How do you create a standard GUI that looks the same on a desktop as it does on the Windows Embedded platform or any platform for that matter? Does this involve creating custom graphics for every single item used in the GUI (ie pushbuttons, drop down menus)?
andre last edited by
There are a few routes:
- use one of the other styles bundled with Qt or found in other places
- create your own custom QStyle
- use style sheets.
In terms of color, styles may be adapted in the colors they use using the palette. That does not work for all styles though, especially the ones using native calls to render elements.
You can select style at runtime using -style option (see "the docs":http://qt-project.org/doc/qt-5.0/qtwidgets/qstyle.html). There are several built-in styles you can choose, and that does not require any coding on your part.
If you are after a different look, you can use QStyle subclasses, or QSS, to change the appearance easily - but that requires a bit more work.
[quote author="sierdzio" date="1371557926"]You can select style at runtime using -style option (see "the docs":http://qt-project.org/doc/qt-5.0/qtwidgets/qstyle.html). There are several built-in styles you can choose, and that does not require any coding on your part.
If you are after a different look, you can use QStyle subclasses, or QSS, to change the appearance easily - but that requires a bit more work.[/quote]
Great! Makes life a lot easier. One question though, does not going with the native style slow the application down at all?
andre last edited by
Nope, it should not, unless the style you choose is very complex or inefficiently implemented.
Using the following code in my main():
QApplication::setStyle("plastique"); /Can choose from windows, plastique, motif, cde, cleanlooks, windowsxp, windowsvista, macintosh/
QApplication app(argc, argv);@
First question, does DesktopSettingsAware(false) actually do anything? I didnt really notice a difference.
Second, on a Windows XP platform I was able to change between cleanlooks, motif, etc, however when trying macintosh, it did not work. I am assuming that this style is not available if you are not working on a mac however if I am using a windows ce platform, which styles would be available? What if I wanted the macintosh look on windows ce. Is that possible? I am trying to avoid the native Windows CE look at all costs because it is quite ugly...
Mac is always tricky, I don't know the answer in that scenario. In general, default styles should be available everywhere (you can run Windows style on Linux, for example). This is usually restricted to "base" styles (so, default Windows instead of Win7 style, for example).
Or you can go for QSS (see "this brilliant example":https://github.com/ColinDuquesnoy/QDarkStyleSheet), but be careful - QSS does introduce performance penalty that can be quite severe (app startup takes longer due to style parsing, for example).