Hello,
I just joined this list and am new to PyQt (and Qt). I've scanned the
archives, but I'm not sure even what I'm looking for to answer my
question.
I'm looking over some C++ code, trying to rewrite it in Python. (My
Spanish is much better than my C++!) I'm sub-classing and extending
QDirModel and getting the following error:
TypeError: first argument of unbound method QDirModel.data() must be
a QDirModel instance
The C++ methods are:
virtual QVariant data(const QModelIndex &index, int role =
Qt::DisplayRole) const
{
if (role == Qt::CheckStateRole && index.column() == 0) {
return
checkstates.value(fileInfo(index).absoluteFilePath(), Qt::Unchecked);
}
return QDirModel::data(index, role);
}
My translation so far looks like this:
[ ... ]
class DirModel(QtGui.QDirModel):
def data(self, index, role=QtCore.Qt.DisplayRole):
if (role == QtCore.Qt.CheckStateRole and index.column() == 0):
return checkstates.value(fileInfo(index).absoluteFilePath(),
QtCore.Qt.Unchecked)
return QtGui.QDirModel.data(index, role)
[ ... ]
Not sure how to make the first argument (index or self?) be a
QDirModel instance. Ultimately I'm hoping for a directory tree with
check boxes.
Suggestions?
Thanks in advance!
Scott
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt