Closed Gonglitian closed 1 year ago
不支持 QPixmap
,目前只支持以下几种:
str
:图标路径QIcon
FluentIconBase
的子类str
:尝试后同样报错QIcon
: 尝试后同样报错
但是,
将"***\lib\site-packages\qfluentwidgets\common\icon.py"中的drawIcon()函数中的
painter.drawPixmap(rect, image)
改为
painter.drawPixmap(rect.toRect(), image)
后
问题解决+ Qicon 报错复现:
self.navigationInterface.addItem(
routeKey=self.chatInterface.objectName(),
icon=QIcon(QPixmap(icon_dir + "robot.png")),
text="Chat",
onClick=lambda: self.switchTo(self.chatInterface),
)
self.navigationInterface.addItem(
routeKey=self.chatInterface.objectName(),
icon=(icon_dir + "robot.png"),
text="Chat",
onClick=lambda: self.switchTo(self.chatInterface),
)
@zhiyiYo
感谢反馈,目前已修复此问题
代码
报错信息