[PyKDE] PyQT 4.x Display Roles
chambers at imageworks.com
Wed Oct 11 21:10:34 BST 2006
Andreas Pakulat wrote:
> On 10.10.06 21:19:59, M.Chambers wrote:
>> How can I disable some that I'm not using? Seems like a waste to call
>> data() that many times. I'm using the model view stuff and its very
>> slow compared to Qt3.
> You can't or at least you can't with the built-in Q*Views. You'd have to
> write your own view class that only asks for the roles you need.
> Also for speeding things up, try to check the role parameter as one of
> the first things and return an empty QVariant() if it is uninteresting.
> If that's still to slow get a profiling tool and check where the time is
> really spend.
I ended up making a single QVariant and return that over and over again,
helped to speed it up:
def data(self, index, role):
if role != DISPLAY_ROLE:
if not index.isValid():
el = index.internalPointer()
return QtCore.QVariant( el.get(self.__columns[index.column()]) )
*Matt Chambers <chambers at imageworks.com>*
*Sony Pictures Imageworks*
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt