PySide 1.2.1中缺少SVG支持

时间:2014-04-25 19:33:28

标签: enthought

通过Canopy Package Manager安装PySide 1.2.1,我得到以下一组支持的图像格式:

>>> from PySide import QtGui
>>> QtGui.QImageReader.supportedImageFormats()
[PySide.QtCore.QByteArray('bmp'),
 PySide.QtCore.QByteArray('pbm'),
 PySide.QtCore.QByteArray('pgm'),
 PySide.QtCore.QByteArray('png'),
 PySide.QtCore.QByteArray('ppm'),
 PySide.QtCore.QByteArray('xbm'),
 PySide.QtCore.QByteArray('xpm')]

如果我降级到PySide 1.1.0,我会得到以下结果:

>>> from PySide import QtGui
>>> QtGui.QImageReader.supportedImageFormats()
[PySide.QtCore.QByteArray('bmp'),
 PySide.QtCore.QByteArray('gif'),
 PySide.QtCore.QByteArray('ico'),
 PySide.QtCore.QByteArray('jpeg'),
 PySide.QtCore.QByteArray('jpg'),
 PySide.QtCore.QByteArray('mng'),
 PySide.QtCore.QByteArray('pbm'),
 PySide.QtCore.QByteArray('pgm'),
 PySide.QtCore.QByteArray('png'),
 PySide.QtCore.QByteArray('ppm'),
 PySide.QtCore.QByteArray('svg'),
 PySide.QtCore.QByteArray('svgz'),
 PySide.QtCore.QByteArray('tif'),
 PySide.QtCore.QByteArray('tiff'),
 PySide.QtCore.QByteArray('xbm'),
 PySide.QtCore.QByteArray('xpm')]

是否需要一些额外的配置来恢复丢失的格式?

我在Mac OS X上运行Canopy v1.3.0.1715。

1 个答案:

答案 0 :(得分:1)

额外的图像格式处理程序作为Qt插件分发,但看起来尽管存在qt.conf文件,Qt仍无法找到它们。我们将在未来版本中修复此问题,但与此同时,您可以通过在环境中设置QT_PLUGIN_PATH变量来解决此问题。例如:

export QT_PLUGIN_PATH=/Applications/Canopy.app/appdata/canopy-1.3.0.1715.macosx-x86_64/Canopy.app/Contents/plugins

[编辑]

实际上,在创建应用程序对象后,可以正确找到插件fodler:

>>> from PySide import QtCore, QtGui
>>> app = QtCore.QCoreApplication([])
>>> import pprint
>>> pprint.pprint(QtGui.QImageReader.supportedImageFormats())
[PySide.QtCore.QByteArray('bmp'),
 PySide.QtCore.QByteArray('gif'),
 PySide.QtCore.QByteArray('ico'),
 PySide.QtCore.QByteArray('jpeg'),
 PySide.QtCore.QByteArray('jpg'),
 PySide.QtCore.QByteArray('mng'),
 PySide.QtCore.QByteArray('pbm'),
 PySide.QtCore.QByteArray('pgm'),
 PySide.QtCore.QByteArray('png'),
 PySide.QtCore.QByteArray('ppm'),
 PySide.QtCore.QByteArray('tga'),
 PySide.QtCore.QByteArray('tif'),
 PySide.QtCore.QByteArray('tiff'),
 PySide.QtCore.QByteArray('xbm'),
 PySide.QtCore.QByteArray('xpm')]
>>>

但svg格式似乎仍然是MIA。我会进一步检查。