QGraphicsSVGItem忽略(某些)剪切路径。为什么?

问题描述 投票:0回答:1

[This SVG image在Firefox和Inkscape中正确渲染,但是由于某些原因,当使用没有任何花哨的QGraphicsSVGItem时,它以这种方式呈现:

供参考,这是在Firefox上的外观:

“83ecb93a-BFDF-45fc-b41c-5255655ae7e3-image.png”

如您所见,卡的背面不应超出白色边框。

我做错什么了吗?是否有(最好是简单的)修复程序?

MWE:

import sys from PyQt5 import QtWidgets, QtCore, Qt, QtGui app = QtWidgets.QApplication(sys.argv) scene = QtWidgets.QGraphicsScene() scene.addItem(Qt.QGraphicsSvgItem("back-red.svg")) graphics_view = QtWidgets.QGraphicsView() graphics_view.setScene(scene) graphics_view.show() sys.exit(app.exec())

[此SVG图像已在Firefox和Inkscape中正确渲染,但是由于某些原因,当使用没有任何花哨的QGraphicsSVGItem时,它会以这种方式呈现:供参考,这是它的样子……
python pyqt pyqt5 qgraphicssvgitem
1个回答
0
投票
[您的svg可能不符合Qt使用的特征(有关更多信息,请阅读here)。一种可能的解决方案是使用QWebEngineView(python -m pip install pyqtwebengine):
© www.soinside.com 2019 - 2024. All rights reserved.