<div dir="ltr">The only thing I mean by this that the data I'm displaying as a tree is in a database that can and will be updated from multiple locations and will change frequently. The tree view is alphabetized and so the 3 row may become the 5 row and so the index row value will frequently be outdated. In addition to this, the leaves of the tree are frequently associated with multiple trunks. Basically picture the leaf as a song and the trunk as the artist. Several songs have multiple artists and are listed under all of them in the tree. Therefore, I can't just assume the first artist listed is always the artist of the song. Therefore, the initial solution I had was to store the artist item, the row the artist was in, and the song in a tuple. I would then check the current row of the artist and compare it to the old row and if it was different, then signal a layout change. The same for the song row which is already included in the index. Not a perfect DB change detection system, but would work for now. Therefore, I would probably store that tuple in the dictionary and retrieve it based on the id in the internalptr of the index and clear the database whenever I issue a layout change.<br>
<br>Thanks,<br>Doug<br><br><div class="gmail_quote">On Sun, Sep 14, 2008 at 9:27 AM, Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de">apaku@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On 14.09.08 09:01:49, Doug Nichols wrote:<br>
> Yea, but the C++ equivalent also doesn't do GC, I was reling on the Python<br>
> GC to do my memory management for me. Bad/Lazy programming style.<br>
<br>
</div>Well ideally you shouldn't need to care.<br>
<div class="Ih2E3d"><br>
> I'll look into the dictionary concept. I just need to determine when<br>
> to clear the dictionary, because the Indices created were thrown away.<br>
> I assume it would be whenever a layoutChanged() signal is emitted?<br>
<br>
</div>I'm not sure what you mean here. What I meant was for each item you have<br>
in your model, you keep a map of a unique identifier (for example<br>
obtained via id()) and that "item" (data structure of your data). And<br>
let the model index carry that number instead of some data-pointer. And<br>
of course your model should know when some of its underlying data is<br>
being removed. layoutChanged is meant for things like the view or<br>
selection model to get notified when your models underlying data changed<br>
significantly.<br>
<br>
Andreas<br>
<font color="#888888"><br>
--<br>
Future looks spotty. You will spill soup in late evening.<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Doug Nichols<br><a href="mailto:doug16@gmail.com">doug16@gmail.com</a><br><a href="http://dnwnichols.home.comcast.net/">http://dnwnichols.home.comcast.net/</a><br>
</div>