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.
QListView with row background in two different colors