<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I actually went ahead and made the changes I needed to move the data
into the model. Instead of just<br>
replacing the data entirely, I have a loop for updating and inserting,
and one for deleting. Updating<br>
existing data works great, adding/removing is where I'm having issues.<br>
<br>
My data is based off ElementTree. The first thing I do is create a
dictionary that maps each element, to<br>
its parent, and its row:<br>
<br>
{<br>
<Element 'g' at 0xf6bfeae8>: (<Element 'payload' at
0xf6bfe8d8>, 0),<br>
<Element 'e' at 0xf6bfe938>: (<Element 'g' at 0xf6bfeae8>,
0), <br>
<Element 'e' at 0xf6bfeb90>: (<Element 'g' at 0xf6bfeae8>,
1), <br>
<Element 'e' at 0xf6bfeba8>: (<Element 'g' at 0xf6bfeae8>,
2), <br>
<Element 'e' at 0xf6bfebc0>: (<Element 'g' at 0xf6bfeae8>,
3)<br>
}<br>
<br>
I can detect if one of these elements is not in the new ElementTree,
but, how do I get the info needed<br>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="qrichtext" content="1">
to call beginRemoveRows( QModelIndex parent, int row, int col). I can
get the row,col no problem, <br>
but how can I get the deleted items parent QModelIndex?<br>
<br>
Matt<br>
<br>
<blockquote cite="mid200611161337.32825.newellm@blur.com" type="cite">
<pre wrap="">Why not just avoid calling reset? If you use beginInsertRows, layoutChanged,
or whatever is needed, then the selection will be maintained automatically.
Matt
_______________________________________________
PyKDE mailing list <a class="moz-txt-link-abbreviated" href="mailto:PyKDE@mats.imk.fraunhofer.de">PyKDE@mats.imk.fraunhofer.de</a>
<a class="moz-txt-link-freetext" href="http://mats.imk.fraunhofer.de/mailman/listinfo/pykde">http://mats.imk.fraunhofer.de/mailman/listinfo/pykde</a>
</pre>
</blockquote>
<br>
</body>
</html>