Use of Qt standard icons from within Qt Creator

Horst Walter picture Horst Walter · Sep 6, 2012 · Viewed 23.2k times · Source

I would like to use the Qt Standard icons (as here). I have found many examples how to set the icons programmatically (runtime in code).

However, how could I set the "standard icon name" (e.g. application-exit) in Qt Creator? This blog here says, I do simply set the theme to the respective name. But I do not have such a theme property, I'd get a popup with a resource (screenshot below).

Where is the right place to apply the "standard name" (e.g. application-exit)?

Update from 2.4.x to Qt Creator 2.5.2 gives me the "theme" property from the above blog, but still no visible icons yet. What else is required to make the icons visible?

Theme now available with Creator 2.5.2

Remark Qt 4.8.1, now updated to 2.5.2, Windows 7

Answer

ypnos picture ypnos · Nov 14, 2013

Theme icons are only supported on Linux/X11. On Windows and OS X, you have to provide your own icons.

The solution to this problem is to set the theme name in QtCreator (as in your example). Then you have to provide icons of the same Alias under Prefix ":/icons" in your resources. You can leverage icons from sets available in the public domain, e.g. the popular Tango icon set.

If you only target the Windows platform, the theme setting will be of no use for you. If you target both Linux/X11 and other platforms, with this solution you get the native icons on one system and the icons you provide yourself on the others.

You can find a very good explanation on how to do it here: http://mithatkonar.com/wiki/doku.php/qt/icons