[PyQt] Maintaining index after sort
mrossi19 at gmail.com
Sun May 29 03:58:36 BST 2011
Hi all. Hopefully this is the correct place. Google searches etc, came up
empty although I have to think this is a common question.
I have a Model-View app using the QAbstractTableModel as the base class for
my model. As I receive data across the tcp pipe (using PyZMQ) I check if
this is a new item or an update by looking to see if I already have an index
for the data received.
if (sinfo.symbol not in symbols):
row = form.model.rowCount()
index = form.model.index(row, 0)
symbols[sinfo.symbol] = index
index = symbols[sinfo.symbol]
All works well until I sort, then all my previously stored indices have the
wrong rows. How do you handle this? Obviously if I disable sorting all
works fine, but that is not an option. This seems like there is probably an
obvious solution that for some reason I can't find. Help would be much
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt