zhiyiYo / PyQt-Fluent-Widgets

A fluent design widgets library based on C++ Qt/PyQt/PySide. Make Qt Great Again.
https://qfluentwidgets.com
GNU General Public License v3.0
5.61k stars 541 forks source link

导航栏自定义图标时出错 #24

Closed Gonglitian closed 1 year ago

Gonglitian commented 1 year ago

代码

        self.navigationInterface.addItem(
            routeKey=self.promptInterface.objectName(),
            icon=QPixmap(icon_dir + "prompt.png"),
            text="Prompt",
            onClick=lambda: self.switchTo(self.promptInterface),
        )

报错信息

File "***\lib\site-packages\qfluentwidgets\common\icon.py", line 89, in drawIcon
    painter.drawPixmap(rect, image)
TypeError: arguments did not match any overloaded call:
  drawPixmap(self, QRectF, QPixmap, QRectF): not enough arguments
  drawPixmap(self, QRect, QPixmap, QRect): argument 1 has unexpected type 'QRectF'
  drawPixmap(self, Union[QPointF, QPoint], QPixmap): argument 1 has unexpected type 'QRectF'
  drawPixmap(self, QPoint, QPixmap): argument 1 has unexpected type 'QRectF'
  drawPixmap(self, QRect, QPixmap): argument 1 has unexpected type 'QRectF'
  drawPixmap(self, int, int, QPixmap): argument 1 has unexpected type 'QRectF'
  drawPixmap(self, int, int, int, int, QPixmap): argument 1 has unexpected type 'QRectF'
  drawPixmap(self, int, int, int, int, QPixmap, int, int, int, int): argument 1 has unexpected type 'QRectF'
  drawPixmap(self, int, int, QPixmap, int, int, int, int): argument 1 has unexpected type 'QRectF'
  drawPixmap(self, Union[QPointF, QPoint], QPixmap, QRectF): argument 1 has unexpected type 'QRectF'
  drawPixmap(self, QPoint, QPixmap, QRect): argument 1 has unexpected type 'QRectF'
zhiyiYo commented 1 year ago

不支持 QPixmap,目前只支持以下几种:

Gonglitian commented 1 year ago
Gonglitian commented 1 year ago
+  Qicon 报错复现:
  self.navigationInterface.addItem(
            routeKey=self.chatInterface.objectName(),
            icon=QIcon(QPixmap(icon_dir + "robot.png")),
            text="Chat",
            onClick=lambda: self.switchTo(self.chatInterface),
        )
Gonglitian commented 1 year ago
Gonglitian commented 1 year ago

@zhiyiYo

zhiyiYo commented 1 year ago

感谢反馈,目前已修复此问题