<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><br>Hi,..I'm trying to save the contents of a QSortFilterProxyModel<br>(self.proxyModel) as a pickle format file.<br>The code below appears to work, but unfortunately, there's<br>nothing in the file....zero size file..<br><br><div style="margin-left: 40px;"> def saveAsPickle(self):<br> fname = "C:/tmp/pick.dat"<br> file = open(unicode(fname), "w")<br> newModel = self.proxyModel<br> pickle.dump(newModel, file)<br></div><br>So, I decided to take step back and save the file as simple text,<br>and that works fine...so I know the data in self.proxyModel is<br>good and is there...<br><br>After several hours of tinkering and research,...I'm a bit stumped.<br>I read somewhere...that the statement<br> newmodel = self.proxyModel<br>was necessary,...or
advised,..though I'm not totally clear why..<br><br>Would it have something to do with the presence of an item in<br>the database stored as<br><br><div style="margin-left: 40px;">QtCore.QDateTime(QtCore.QDate(2010,11,2)),<br></div><br>...which is also printed/saved out as that in the simple text save<br>function...All other data in the model are simple strings...at least<br>as of yet,...plan is to add an image/icon in there somewhere..<br><br>Although there seem to be a lot of examples out there that <br>deal with basic use of pickle,..I haven't found any dealing with<br>QSortFilterProxyModel....and/or QTable-, QTree-, QListView...<br>Is there another preferred way of saving data from these three<br>elements?<br><br>This is the class/init part at the top<br><br><div style="margin-left: 40px;">class Window(QtGui.QWidget):<br> def __init__(self):<br> super(Window,
self).__init__()<br><br> self.proxyModel = QtGui.QSortFilterProxyModel()<br> etc<br> etc<br></div><br>Any help or advice would be greatly appreciated,..<br><br></td></tr></table><br>