python – PyQt/PySide中是否有默认图标?

我正在读一本关于PySide的教程,我在想,我需要为每一件事找到自己的图标,还是有一些方法来使用一些内置的图标。这样,如果我想要我的小gui在另一个桌面环境中运行,我不需要找到一整套新的图标。
您需要的是Pyside QIcon.fromTheme功能。
它基本上创建了从当前系统主题的所需图标的QIcon对象。

用法:

undoicon = QIcon.fromTheme(“edit-undo”)

“编辑撤销” – 可以找到图标“type”/“function”的名称here

这适用于X11系统,MacOSX和Windows检查QIcon文档
QIcon.fromTheme

编辑从网站插入,自从上次以来是一个破碎的链接。

static PySide.QtGui.QIcon.fromTheme(name[, fallback=QIcon()])

Parameters:

  • name – unicode
  • fallback – 07002

Return type:

07002

Returns the 07002 corresponding to name in the current icon theme. If no such icon is found in the current theme
fallback is returned instead.

The latest version of the freedesktop icon specification and naming specification can be obtained here:

  • 07005
  • 07006

To fetch an icon from the current icon theme:

06000

Or if you want to provide a guaranteed fallback for platforms that do not support theme icons, you can use the second argument:

06001

Note

By default, only X11 will support themed icons. In order to use themed icons on Mac and Windows, you will have to bundle a compliant theme in one of your 07007 and set the appropriate 07008 .

See also

  • 07008
  • 070010
  • 07007
http://stackoverflow.com/questions/11643221/are-there-default-icons-in-pyqt-pyside

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:python – PyQt/PySide中是否有默认图标?