QIdentityProxyModel doesn't change text color?

234 views Asked by At

I want to change the text color. I have a SqlRelationalTableModel and as I have found out the proper way is to use QIdentityProxyModel.

I have set up the proxy, assigned it to the model and table view, but it doesn't work.

Any suggestions?

<...>
myproxy = MyProxy()
myproxy.setSourceModel(orders_model)
tableView.setModel(myproxy)  
<...>

class MyProxy(QtCore.QIdentityProxyModel):
    def  data(self, index, role):
        if role == QtCore.Qt.TextColorRole:
            return QtCore.QVariant(QtGui.QColor(QtCore.Qt.gray))
        elif role == QtCore.Qt.DisplayRole:
            return QtCore.QIdentityProxyModel.data(self, index, role)
0

There are 0 answers