Thanks for the reply. There must be some core concept of Qt/Model-View programming I am just missing.<div><br></div><div>Makes sense that I can store the data keyed by symbol in the model and update it that way, but I thought I had to emit a dataChanged signal for the view to update as shown below:</div>
<div><br></div><div> self.emit(SIGNAL("dataChanged(QModelIndex,QModelIndex)"), self.index(index.row(), COL1), self.index(index.row(), COL5))</div><div><br></div><div>Doing it this way required me to have the index for the column I wanted refreshed. I see there is a 'match()' function in the QAbstractItemModel class but when I tried that (calling match for every update) things were ridiculously slow.</div>
<div><br></div><div>Marc</div><div><br></div><div><br></div><div><div class="gmail_quote">On Sun, May 29, 2011 at 4:03 AM, Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de" target="_blank">apaku@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On 28.05.11 21:58:36, Marc Rossi wrote:<br>
> Hi all. Hopefully this is the correct place. Google searches etc, came up<br>
> empty although I have to think this is a common question.<br>
><br>
> I have a Model-View app using the QAbstractTableModel as the base class for<br>
> my model. As I receive data across the tcp pipe (using PyZMQ) I check if<br>
> this is a new item or an update by looking to see if I already have an index<br>
> for the data received.<br>
<br>
</div>Model indexes are not meant to be stored over time, they're short-lived<br>
objects. You could try Persistent Model Indexes, which are meant to be<br>
stored.<br>
<br>
But you don't need the index at all, your model just needs a function<br>
that takes the sinfo and updates its internal structure by using<br>
sinfo.symbol to identify which entry to update. In fact I think the<br>
if/else you've showed should be part of the model, so that the outside<br>
can simply do something like: model.addData(sinfo).<br>
<br>
Andreas<br>
<br>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</blockquote></div><br></div>