[PyQt] Resizing rows to contents after sort when QSortFilterProxyModel is used
waterbug at pangalactic.us
Fri Feb 5 16:42:16 GMT 2016
Any ideas on this one?
On 02/03/2016 01:15 PM, Steve Waterbury wrote:
> 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). That much works
> fine when the table is first set up.
> However, the sizing to contents is lost when a sort is
> done, and in googling for solutions I came across a
> suggestion to connect the horizonal header's
> 'sortIndicatorChanged' signal to the table view's
> 'resizeRowsToContents', which seems reasonable but
> doesn't work properly in my case --
> I suspect that is because of the remapping done by the
> proxy model. Is there an easy way to make
> 'resizeRowsToContents' aware of the sorted row mapping?
> (Perhaps something analogous to proxy's 'mapToSource',
> which I am using to get the correct row selections?)
> Hope this question is clear enough -- if not, let me know
> and I'll include some code.
> PyQt mailing list PyQt at riverbankcomputing.com
More information about the PyQt