[PyQt] dirmodel
Phil Thompson
phil at riverbankcomputing.com
Sat Nov 8 10:14:12 GMT 2008
On Sat, 08 Nov 2008 10:10:33 +0000, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> 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)
Sorry - forget that, I didn't read your question closely enough. (Only had
one cup of tea so far, can't really function until the second.)
Phil
More information about the PyQt
mailing list