[Kde-bindings] Subclassing any data models causes the interface to be slow

Chris Burel chrisburel at gmail.com
Thu Oct 9 08:30:58 UTC 2008


I was testing out making a subclass of QAbstractItemModel in my
PerlQt4 implementation, and I noticed that when I hook up something
like a TreeView to my custom model, the interaction of the interface
slows down quite noticeably.  So I tried out the
examples/itemviews/simpletreemodel example in QtRuby (I had to muck
with it a bit to get it to run...) to find the same issue.  It's
clearly visible when you toggle between maximized and non-maximized
states, the repaint takes about half a second to occur.  This
half-second delay is also apparent when you try to expand any of the
children in the tree view.  I did some profiling of my perl code and
found that on a simple action such as the window gaining or losing
focus, the data method of the data model was called about 400 times,
and a click causes 1000-2000 calls, so I expect this is the cause of
things being slow.

Is this a known problem?  My understanding is that to use any
List/Tree/Table view in Qt4 and display useful data, you have to
subclass one of the data model classes.  Are there any ideas on how to
reduce that delay when using a custom data model?



More information about the Kde-bindings mailing list