<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Date: Fri, 5 Feb 2016 11:42:16 -0500<br>
From: Steve Waterbury <<a href="mailto:waterbug@pangalactic.us">waterbug@pangalactic.us</a>><br>
To: <a href="mailto:pyqt@riverbankcomputing.com">pyqt@riverbankcomputing.com</a><br>
Subject: Re: [PyQt] Resizing rows to contents after sort when<br>
        QSortFilterProxyModel is used<br>
Any ideas on this one?<br>
<br>
> I'm using a QTableView with a QSortFilterProxyModel.<br>
> When I first instantiate and populate the<br>
> table view, I call resizeColumnToContents on each<br>
> column, followed by resizeRowsToContents on the table<br>
> view (there are some multi-line cells).<br>
><br>
> However, the sizing to contents is lost when a sort is done<br></blockquote><div><br></div><div>You need to grab some signal that is emitted when the sort completes and the view has been completely repopulated with sorted data. (Sort indicator changed might not necessarily correspond to that.) My guess would be  modelReset. I *think* the way the sort filter proxy works is, it tells the view, modelAboutToBeReset, then modelReset, which makes the view repopulate itself by calling the data() method of the model.<br></div></div></div></div>