How to change cell's background color of a QTableView [duplicate]
问题 This question already has answers here : background color of cells in QTableview, PySide2 (1 answer) PyQt Tableview background color based on text value rather than True or False (1 answer) Closed 6 months ago . I have a table view displaying a QAbstractTableModel, I managed to color a row within the data function but I just want to color the cell and not the entire row. i.e if the cell value = "In error" I want to color it in red I have tried to set a color to the cell using the setData