[PyQt] QSortFilterProxyModel - AttributeError
Mads Ipsen
mpi at comxnet.dk
Fri Jun 5 17:22:03 BST 2009
Hi,
The script below fails with
PyQt-4.4.4
qt-4.5.1
giving the error:
Traceback (most recent call last):
File "simple.py", line 14, in <module>
print proxy_model.sortColumn()
AttributeError: sortColumn
Am I missing something here?
Best regards,
Mads
import sys
from PyQt4 import QtCore, QtGui
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
# Set up a model and proxy model
model = QtGui.QFileSystemModel()
proxy_model = QtGui.QSortFilterProxyModel()
proxy_model.setSourceModel(model)
proxy_model.sort(0, QtCore.Qt.AscendingOrder)
# print properties - will fail
print proxy_model.sortColumn()
print proxy_model.sortOrder()
sys.exit(app.exec_())
More information about the PyQt
mailing list