[PyQt] QTableWidget Data Paste Time

David Douard david.douard at logilab.fr
Thu Jul 31 10:24:37 BST 2008


On Wed, Jul 30, 2008 at 02:22:38PM -0700, Glenn Linderman wrote:
> On approximately 7/30/2008 2:10 PM, came the following characters from  
> the keyboard of B Clowers:
>> Greetings,
>>
>> I'm interested in incorporating a QTableWidget into one of my  
>> applications and would like to give it the functionality to cut, copy,  
>> and paste a user selection.  So far I've implemented the copy and  
>> paste actions to a functional level.  However, I often deal with very  
>> large arrays (e.g. 250000) rows, as such when pasting an array of that  
>> size it seems to take on the order of 8-10 seconds to actually set the  
>> data in the table.  I've attached a small example script that has the  
>> copy and paste functionality and was hoping some of the more  
>> experienced programmers out there could take a look and comment on  
>> whether it is possible to commit data to the QTableWidget in a more  
>> efficient manner.  So far I've only been able to use the setItem()  
>> function iteratively.  There doesn't seem to be a setItems() (i.e.  
>> setting a large list of items at one time).  Thanks for your help.
>>
>> Brian
>>
>> -ps I didn't attach a text file with 250000 rows as it is about 1MB  
>> compressed, though if anyone is interested let me know and I'll send  
>> it on.
>>
>>
> So, I'm a PyQt newbie, so I can't help, but I can add that I've also  
> noticed that originally populating a large QTableWidget takes a long 
> time.

The solution for this is to use a QTableView and a QTableModel. See Qt
documentation on
http://doc.trolltech.com/4.4/model-view-introduction.html

and examples in PyQt (eg. in examples/itemviews ).



>
> So if someone can offer help, it would help us both!
>
> -- 
> 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 list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

-- 
David Douard                        LOGILAB, Paris (France), +33 1 45 32 03 12
Formations Python, Zope, Debian :   http://www.logilab.fr/formations
Développement logiciel sur mesure : http://www.logilab.fr/services
Informatique scientifique :         http://www.logilab.fr/science
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080731/6f1856fe/attachment.bin


More information about the PyQt mailing list