def data(self, index, role=QtCore.Qt.DisplayRole):
    if self.condition and role == QtCore.Qt.TextColorRole:
        text = index.data(QtCore.Qt.DisplayRole)
if self.condition in text:
    return QtGui.QColor('#58cd1c')
return super(FileSystemModel, self).data(index, role)


class MainWidget(QtGui.QWidget):

    def __init__(self, parent=None, useDelegate=False):
        super(MainWidget, self).__init__(parent)
Conditionally change color of files in QListView connected to QFileSystemModel