[PyQt] dirmodel
Phil Thompson
phil at riverbankcomputing.com
Sat Nov 8 10:10:33 GMT 2008
On Sat, 8 Nov 2008 00:00:04 +0100, Krzysztof <k4chim at gmail.com> wrote:
> hi,
> how can I list all files and dirs including ".." except "."
>
> I do this
>
> class QDirModelEx(PyQt4.QtGui.QDirModel):
> def __init__(self, parent = None):
> PyQt4.QtGui.QDirModel.__init__(self, parent)
> 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
>
> but it only set display name to "", how van I remove this item
> thanks in advance
Use QDirModel.setFilter(QDir.NoDotAndDotDot)
Phil
More information about the PyQt
mailing list