[PyQt] PyQt Digest, Vol 139, Issue 6
Steve Waterbury
waterbug at pangalactic.us
Fri Feb 12 06:17:20 GMT 2016
On 02/05/2016 04:25 PM, David Cortesi wrote:
> From: Steve Waterbury <waterbug at pangalactic.us
> Any ideas on this one?
>
> > I'm using a QTableView with a QSortFilterProxyModel.
> > When I first instantiate and populate the
> > table view, I call resizeColumnToContents on each
> > column, followed by resizeRowsToContents on the table
> > view (there are some multi-line cells).
> >
> > However, the sizing to contents is lost when a sort is done
>
> 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.
Seemed like a logical approach but doesn't work -- thanks anyway.
I guess I will have to implement the sort myself and refresh the
view. I'm rather surprised that Qt doesn't handle this rather
simple scenario!
Steve
More information about the PyQt
mailing list