[PyQt] using pickle to save contents of QSortFilterProxyModel
jpolk5001 at yahoo.com
Sat Nov 20 01:31:26 GMT 2010
Hi,..I'm trying to save the contents of a QSortFilterProxyModel
(self.proxyModel) as a pickle format file.
The code below appears to work, but unfortunately, there's
nothing in the file....zero size file..
fname = "C:/tmp/pick.dat"
file = open(unicode(fname), "w")
newModel = self.proxyModel
So, I decided to take step back and save the file as simple text,
and that works fine...so I know the data in self.proxyModel is
good and is there...
After several hours of tinkering and research,...I'm a bit stumped.
I read somewhere...that the statement
newmodel = self.proxyModel
was necessary,...or advised,..though I'm not totally clear why..
Would it have something to do with the presence of an item in
the database stored as
...which is also printed/saved out as that in the simple text save
function...All other data in the model are simple strings...at least
as of yet,...plan is to add an image/icon in there somewhere..
Although there seem to be a lot of examples out there that
deal with basic use of pickle,..I haven't found any dealing with
QSortFilterProxyModel....and/or QTable-, QTree-, QListView...
Is there another preferred way of saving data from these three
This is the class/init part at the top
self.proxyModel = QtGui.QSortFilterProxyModel()
Any help or advice would be greatly appreciated,..
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt