[英]QListView with row background in two different colors
I use QListView
(in PyQt5) to display strings. 我使用QListView
(在PyQt5中)显示字符串。 I want to have the background color of each item in that list changing between two colors to make it easier to read. 我希望该列表中每个项目的背景色在两种颜色之间变化,以使其更易于阅读。
I tried Qt.DecorationRole
but this only create an "icon" on the left side of each item. 我尝试了Qt.DecorationRole
但这只会在每个项目的左侧创建一个“图标”。
self. 自。 listWidget.setAlternatingRowColors(True) this will give you Alternate color for each row. listWidget.setAlternatingRowColors(True)这将为您提供每行的备用颜色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.