[PyQt] QTableWidget Data Paste Time

B Clowers clowersb at yahoo.com
Thu Jul 31 16:23:00 BST 2008


Thanks for the information.  I was hoping to avoid the model-view as it is pretty daunting task especially for someone new to programming.  I don't suppose that anyone out there may be willing to share and example of how to paste data from the clipboard into a QTableView?

Cheers,

Brian


--- On Thu, 7/31/08, David Douard <david.douard at logilab.fr> wrote:
From: David Douard <david.douard at logilab.fr>
Subject: Re: [PyQt] QTableWidget Data Paste Time
To: pyqt at riverbankcomputing.com
Date: Thursday, July 31, 2008, 3:24 AM

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
_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080731/8a74b39a/attachment-0001.html


More information about the PyQt mailing list