<div id="__MailbirdStyleContent" style="font-size: 12pt;font-family: Candara;color: #000000">
Well, that isn't <i>quite</i> all. Before and after the sorting, I emit the <span style="font-family: Courier New">layoutAboutToBeChanged</span> and <span style="font-family: Courier New">layoutChanged</span> signals. In what will probably prove to be a state of unwarranted naivet<span style="font-size: 12pt;line-height: 1.5">é, I thought that was enough to tell Qt things had changed. (I guess as I think about it, that only tells Qt <i>that</i> things have changed, not how ...)</span><div><br></div><div>I did spend some time trying to set up a <span style="font-family: Courier New">QSortFilterProxyModel</span>. In the time I spent, I did not succeed in wrapping my mind around it, but I could try harder. It's been a couple weeks since I looked at it, but as I recall, I think my hangup seemed to be -- if you're calling a method to modify the model contents (e.g., <span style="font-family: Courier New">begin/endRemovRows()</span> or <span style="font-family: Courier New">begin/endInsertRows()</span>), do you call the method on the proxy, or the original model?</div><div><br></div><div>But I can look at it again, if a direct sort can't (easily) be made to work. If you happen to know of any particularly good tutorials or examples on setting up a proxy, I'd be happy to hear about them.</div><div><br></div><div>Thanks again!</div><div><br></div><div>/John<br><div class="mb_sig"></div>
<blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
<p style="color: #AAAAAA; margin-top: 10px;">On 5/7/2019 12:21:24 PM, Kyle Altendorf <sda@fstab.net> wrote:</p><div style="font-family:Arial,Helvetica,sans-serif">Is this really all you do when you sort?
<br>
<br> # Sort children
<br> def sort_children(self):
<br> self.children.sort(key=lambda x: x.desc())
<br> return
<br>
<br>Yes, that would upset Qt very much. You would need to do a series of
<br>moves or a restructure or... I'm forgetting the terms offhand. But
<br>yes, you have to tell Qt when stuff moves around. This would be part of
<br>why it's useful to let an entirely stock Qt object like a proxy take
<br>care of it for you.
<br>
<br>Cheers,
<br>-kyle
<br></div></blockquote></div></div>