使用Qt Creator中的Qt标准图标 [英] Use of Qt standard icons from within Qt Creator

查看:317
本文介绍了使用Qt Creator中的Qt标准图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Qt标准图标(


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?

Remark Qt 4.8.1, now updated to 2.5.2, Windows 7

解决方案

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

这篇关于使用Qt Creator中的Qt标准图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆