[英]QTableWidget - Change the row color
I'm trying to change the background color of a QTableWidget row.我正在尝试更改 QTableWidget 行的背景颜色。 There are some others posts about the same thing but none of the given solutions worked for me.
还有一些关于同一件事的其他帖子,但没有一个给定的解决方案对我有用。
With that solution, we are setting the background on an already existing item in the table to a light grey on the item at row 0, column 1:使用该解决方案,我们将表中现有项目的背景设置为第 0 行第 1 列项目的浅灰色:
self.table.item(1,0).setBackground(QtGui.QColor(125,125,125))
It's working, but set background for the row with iterating needs more time if you have more then one table.它正在工作,但如果您有多个表,则为迭代行设置背景需要更多时间。 I need a function to change the row background by passing only the row index!
我需要一个函数来通过仅传递行索引来更改行背景!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.