[PyQt] refreshing QTreeView
James Polk
jpolk5001 at yahoo.com
Thu Nov 18 19:24:09 GMT 2010
Good Day to All,
Been writing code for years, but still a bit green when it comes to PyQt,
so please forgive my syntactically lacking question(s) ;-)
I'm hacking a derivative of the (famous?) packaged example that
comes with PyQt4 (and Qt), namely "basicsortfiltermodel.pyw"
from "../examples/itemviews" in PyQt4...
I've added a little popup menu (let's call this B.py) that one can launch
from the BasicSort-derivative (let's call this A.py).
I believe I'm correcting adding new data (a new record) to the
QSortFilterProxyModel(). (I think this because I'm not getting
any errors now, after some effort) But I seem to be unable to get
the QTreeView to refresh. I've scoured the Qt class docs and
Google'd the heck out of it (seems like a common question from
the looks of it, lol)..
Now I know this is an ugly hack, but just to try to get it to work
(elegance can come later is my theory)...
At the bottom of A.py, I declared a global "wX",
global wX;
[...]
window = Window()
wX = Window()
window.setSourceModel(createMailModel(window))
so that when I hit a button later, I could more easily get a hold
of the "parent" value found in the runtime "createMailModel".
>From which I get the "model" handle..
model = QtGui.QStandardItemModel(0, 17, WinX)
addMail(model, "image",
"tabl00",
etc
etc)
Anyways,..I think this is working....
But after adding a new record via addMail(), I can't seem to get
self.proxyModel to refresh itself..
I'm pretty sure this a stupid newbie issue, lol....but could anyone
help shed some light on how to make this work?
Many Thanks,
-Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101118/b6daa313/attachment.html>
More information about the PyQt
mailing list