2 years ago

#5862

test-img

Troy B.

Is it possible to change the text color of text after a new line in a QListWidget?

Picture of what I am trying to achieve

This is the delegate I am currently using to get two lines:

class AccountListDelegate(QtWidgets.QStyledItemDelegate):
    def displayText(self, value, locale):
        text = super().displayText(value, locale)
        separator = ":"
        values = text.split(separator)
        return f"{values[0]}\n{values[1]}"

Is there a way to change the color of the bottom line?

python

list

qt

pyqt

qlistwidget

0 Answers

Your Answer

Accepted video resources