[PyQt] faster alternative to QHeaderView's resizeToContents?
Glenn Linderman
v+pyqt at g.nevcal.com
Sat May 9 09:33:44 BST 2009
On approximately 5/9/2009 12:28 AM, came the following characters from
the keyboard of Edwin Marshall:
> I have a QTableView that displays the contents of a model with over
> 3000 rows, each with 11 columns. I'd like to the original size of
> these columns to be no larger than the content within them, but
> setting their resizeMode's to QHeaderView.resizeToContents causes the
> tremendous slow downs (where originally the data would load in two
> seconds, using this mode causes the data to be loaded after about a
> minute and a half). Is there some faster alternative?
>
> I'm thinking of calculating the width by using the length of the
> largest item in the column, but that would require me to know how
> large in pixels each character is.
>
> Any suggestions? Mean while, I'm going to stare at the Qt
> documentation for a couple more hours to see if I find something.
If you have nothing better to try, I'm wondering if unsetting
QHeaderView.resizeToContents, then loading the data, and then setting it
again, could provide a speedup? If it is successful, let me know. I'm
very novice to Qt, and working on a non-Qt project at the moment, or I'd
try it for you.
--
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking
More information about the PyQt
mailing list