Re: [PyQt] faster alternative to QHeaderView's resizeToContents?

2009-05-12 Thread David Douard
On Saturday 09 May 2009 09:28:16 Edwin Marshall wrote:
>  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?  

This can be done reimplementing the sizeHintForColumn method of a QTableView. 
You should create your own QTableView based class and reimplement this method 
the "smart" way. See Qt doc for more details on this method.




-- 
David DouardLOGILAB, Paris (France), +33 1 45 32 03 12
Formations Python, Numpy, Debian :  http://www.logilab.fr/formations
Développement logiciel sur mesure : http://www.logilab.fr/services
Informatique scientifique : http://www.logilab.fr/science

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] faster alternative to QHeaderView's resizeToContents?

2009-05-09 Thread Demetrius Cassidy

Are you calling resizeToContents for each item in your table?

Sent from my iPhone

On May 9, 2009, at 3:28 AM, Edwin Marshall  wrote:

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.
Get Free 5GB Email – Check out spam free email with many cool featur 
es!

Visit http://www.inbox.com/email to find out more!
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] faster alternative to QHeaderView's resizeToContents?

2009-05-09 Thread Edwin Marshall
Ah, so basically you call fetchMore with a value of 20, then afterwards do a 
fetchMore with the rest of the data? Seems like a good idea. The only thing I'd 
be worried about is that filtering woul be inaccurate until the model had a 
chance to calculate the widths for the rest of it's data. I could disable 
filtering until all the data is loaded, but I would much rather avoid that.

Thanks for the suggestion.

--Edwin Marshall
> -Original Message-
> From: pyqt-requ...@riverbankcomputing.com
> Sent: Sat, 9 May 2009 12:00:09 +0100
> To: pyqt@riverbankcomputing.com
> Subject: PyQt Digest, Vol 58, Issue 14
> 
> Send PyQt mailing list submissions to
>   pyqt@riverbankcomputing.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> or, via email, send a message with subject or body 'help' to
>   pyqt-requ...@riverbankcomputing.com
> 
> You can reach the person managing the list at
>   pyqt-ow...@riverbankcomputing.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of PyQt digest..."
> Today's Topics:
> 
>1. Re: faster alternative to QHeaderView's resizeToContents?
>   (Erik Janssens)
> ___
> PyQt mailing list
> PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] faster alternative to QHeaderView's resizeToContents?

2009-05-09 Thread İşbaran Akçayır
On Sat, May 9, 2009 at 11:33 AM, Glenn Linderman  wrote:
> 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?

Hello,

I had a similar issue, a big slowdown after resetting my model, and i
was thinking the QSortFilterProxyModel is causing this
slowdown. Are you sure the resizetocontents is the source of this
problem ? Or any of you guys have this similar problem with
sortfilterproxy ?

My solution was to use treewidget instead, i also used
resizetocontents in treewidget and had no slowdowns ..

best regards
işbaran

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] faster alternative to QHeaderView's resizeToContents?

2009-05-09 Thread Glenn Linderman
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

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] faster alternative to QHeaderView's resizeToContents?

2009-05-09 Thread 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.




Free 3D Earth Screensaver
Watch the Earth right on your desktop! Check it out at www.inbox.com/earth


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] faster alternative to QHeaderView's resizeToContents?

2009-05-09 Thread 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.



Get Free 5GB Email – Check out spam free email with many cool features!
Visit http://www.inbox.com/email to find out more!


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt