<div dir="ltr">Since you're implementing your own model, implementing removeRows() in the source model should be enough, but you have to ensure that its implementation responds as expected: removeRows has to return a bool, and the parent *must* be checked, expecially if you have a tree structure. Also ensure that all basic model functions (index, parent, rowCount, columnCount and data) are correctly implemented.<div><br></div><div>I'd suggest you to give us a minimal example anyway, you might even find out what is wrong in your case.</div><div><br></div><div>Maurizio</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mar 14 mag 2019 alle ore 21:38 John F Sturtz <<a href="mailto:john@sturtz.org">john@sturtz.org</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id="gmail-m_-4221747021917962755__MailbirdStyleContent" style="font-size:12pt;font-family:Candara;color:rgb(0,0,0)">Hi again.<div class="gmail-m_-4221747021917962755mb_sig"></div><div><br></div><div>I'm the one who started the <b>QTreeView + sort + delete = crash</b> thread on May 8th. In response to assistance from Kyle and Florian, I've re-implemented to use a <span style="font-family:"Courier New"">QAbstractItemModel</span> with associated <span style="font-family:"Courier New"">QSortFilterProxyModel</span>.</div><div><br></div><div>On the whole, that seems to be working pretty well, but there's one thing (well, at least one) I haven't been clear on despite poring over what documentation I can find. I can post the test code again if it will help, but I think this is more of a general question:</div><div><br></div><div>If I have both a source model and also a proxy, and I'm modifying the view in a way that changes the structure (deleting a row, in the current case I'm working on), should I be overriding <span style="font-family:"Courier New"">removeRows()</span> for <i>both</i> the source model and the proxy, and calling <span style="font-family:"Courier New"">beginRemoveRows()/endRemoveRows()</span> in both cases?</div><div><br></div><div>I guess that seems to make sense to me, and my initial testing suggests it's so, as it seems to work (whereas if I <i>don't</i> do that, I either get a crash, or a message something like <span style="font-family:Consolas">QSortFilterProxyModel: inconsistent changes reported by source model</span>).</div><div><br></div><div>Same for inserting rows? Just checking to see if I'm thinking right here.</div><div><br></div><div>Thanks!</div><div><br></div><div>/John</div></div>_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div>