[PyKDE] PyQT 4.x Display Roles

Andreas Pakulat apaku at gmx.de
Thu Oct 12 08:42:16 BST 2006


On 11.10.06 19:46:45, Matt Chambers wrote:
> Many examples show data() actually doing stuff like
> 
> if role != QtCore.Qt.DisplayRole:
>    return QtCore.QVariant()

/me too.

> I was able to eek out quite a bit more speed by creating a global instance of 
> QVariant and returning the same one over and over again, instead of
> creating a new object every time data is called, which can be hundreds of times 
> in just a few seconds.
> 
> so I do:
> if role != QtCore.Qt.DisplayRole:
>    return EMPTY_QVARIANT

Now I got it ;)

> My cpu fan still comes on if I use the scroll bar but its not as bad.

That's not really a profiling tool...

Andreas

-- 
Don't let your mind wander -- it's too little to be let out alone.




More information about the PyQt mailing list