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
4.99k stars 464 forks source link

[Bug]: QListWidgetItem使用setTextColor后TableItemDelegate的initStyleOption报'PySide2.QtGui.QColor' object has no attribute 'color'错误 #905

Closed KeyToon9 closed 1 week ago

KeyToon9 commented 2 weeks ago

What happened?

QListWidgetItem 使用 setTextColor 后 TableItemDelegate 的 initStyleOption 中的

textColor = textBrush.color()

报'PySide2.QtGui.QColor' object has no attribute 'color'错误

Operation System

win10

Python Version

Python 3.7

PyQt/PySide Version

PySide2

PyQt/PySide-Fluent-Widgets Version

v1.5.4

How to Reproduce?

在使用ListWidget时,对item设置颜色setTextColor

https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/f7ef8aa920483d6c7aa2a43504a60ba3a615dbce/qfluentwidgets/components/widgets/table_view.py#L92

Minimum code

list = ListWidget(self)
new_item = QListWidgetItem(list)
new_item.setTextColor(QColor('#ffffff'))
zhiyiYo commented 1 week ago

改成 new_item.setForeground(QColor('#ffffff')