[PyQt] extending qdirmodel

Krzysztof k4chim at gmail.com
Sun Nov 9 23:13:17 GMT 2008


hi,
what's wrong with

class QDirModelEx(PyQt4.QtGui.QDirModel):
    def __init__(self, parent = None):
        PyQt4.QtGui.QDirModel.__init__(self, parent)

    def index(self,  row, column=0, parent = PyQt4.QtCore.QModelIndex()):
        print "index1"
        PyQt4.QtGui.QDirModel.index(self,row, column, parent)
    def index (self, path, column = 0, parent = PyQt4.QtCore.QModelIndex()):
        print "index2"
        return PyQt4.QtGui.QDirModel.index(self, path, column)

    def data(self, index, role = PyQt4.QtCore.Qt.DisplayRole):
        data = PyQt4.QtGui.QDirModel.data(self, index, role)
        if(data.toString().__eq__(".")):
            return PyQt4.QtCore.QVariant()
        return data

when I use this extended class as model, nothing is displayed. My main
aim is to remove one "defined" element from display list. Any clues?
Thanks in advance for answers.
Regards

Krzychu


More information about the PyQt mailing list