Text styling in QTableView with PySide2
问题 I have a QTableView populated with a proper model. I would like to change the style of the text based on the context of it: The text, if there is something between parenthesis, just this part of text should change to green color -parenthesis included- (and bold, just if it is not harder). If you can provide a snippet or super simple example, I appreciate it. 回答1: You have to use a delegate that uses QTextDocument : import random from PySide2 import QtCore, QtGui, QtWidgets words = '''Lorem