[PyKDE] performance issues

Matt Newell newellm at blur.com
Thu Jan 11 00:57:18 GMT 2007

On Wednesday 10 January 2007 15:52, Steven James Samuel Stapleton wrote:
> Sure, I thought the size issue was more due to not wanting to deal with a
> lot of code.
> run the ItemGenerator.py script in the top level directory. I've actually
> got a newer version with tooltips, but this one will do for the example,
> especially since the file in question is a lot shorter (this one also
> displays the behavior, I wrote the new stuff today).
> Click the "add features" button, and a number of sets will be added to the
> lower box equal to the number in the box next to "add feature" button.
> the ui/components/feature_box.py file/class has the class that
> holds/creates the sets (with the addBars() function), and the classes are
> defined in the ui/components/feature_bars.py file/class.
> http://www.thestapletons.org/jim/APPS.tar.bz2
Seems to me that it's the QTextEdit's that are taking the time to construct.  
It takes about 28 seconds to create 1000 "features" - 7000 QTextEdits.  It 
only takes about 3.5 seconds if i replace the QTextEdit's with simple 

I would suggest avoiding so many QTextEdits.   You could use QLineEdits if you 
don't need multiple lines, or avoid using widgets for the view by using a 
QTreeView/QTreeWidget and have custom editting widgets when the user double 
clicks to edit a row.

Also your hide/show functions are redundant.  If you hide a qt widget all of 
it's children are hidden automatically, and will reappear when you show the 
widget.  If you construct a widget with children and call show on it, all the 
children are automatically shown.


More information about the PyQt mailing list