简体   繁体   中英

QListView with row background in two different colors

I use QListView (in PyQt5) to display strings. 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.

self. listWidget.setAlternatingRowColors(True) this will give you Alternate color for each row.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM