Hi all. Hopefully this is the correct place. Google searches etc, came up empty although I have to think this is a common question.<div><br></div><div>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. </div>
<div><br></div><div> if (sinfo.symbol not in symbols):</div><div> row = form.model.rowCount()</div><div> form.model.insertRow(row, sinfo.symbol)</div><div> index = form.model.index(row, 0)</div>
<div> symbols[sinfo.symbol] = index</div><div> form.model.setRiskData(index, sinfo)</div><div> else:</div><div> index = symbols[sinfo.symbol]</div><div>
form.model.setRiskData(index, sinfo)</div><div><br></div><div>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 appreciated.</div>
<div><br></div><div>Thanks</div><div>Marc</div>