May-29-2017, 03:48 PM
I subclassed it:
But how can I make it paint only the rows I want?
How can I pass the color to function data?
class ColorfullSqlQueryModel(QtSql.QSqlQueryModel): def __init__(self, dbcursor=None): super(ColorfullSqlQueryModel, self).__init__() def data(self, QModelIndex, role=None): v = QtSql.QSqlQueryModel.data(self, QModelIndex, role); if role == QtCore.Qt.BackgroundRole: return QtGui.QColor(QtCore.Qt.yellow) return (v);It works!! Turns all rows to yellow!
But how can I make it paint only the rows I want?
How can I pass the color to function data?