[Qt-interest] Efficient GV clipping

Jason H scorp1us at yahoo.com
Wed Sep 30 17:13:03 CEST 2009


I need to scroll and fade some text (Actually, a painter path) inside a clipping rect (QGraphicsRectItem, with the ItemClipsChildrenToShape flag set) . The text is a few paragraphs in length (300 words, showing about 100 at a time).  My current approach is to make a QPainterPathItem which is the text, wrapped to the width of the clipping rect. 

I then fade in by modifying the opacity, then I change the position of the graphics item to accomplish the scroll. It works fine for small amounts of text - 20 words or so. But when I use a larger amount of text, the graphicsView goes un-updated for a while, and the text fade-in ends without ever being seen, and the position animation runs, albeit a bit choppy (text moves about 5 pixels per update), but not really horrible. It's consistently updating, but  I'd like more updates. 

I read that clipping means a large performance hit.

I am not sure of exactly how Qt handles the situation, but I think what I need is a better way to draw only parts of the path that are only on the screen. Are there other flags I can set? Is there a way I can place the clipping rect over the path and only extract those items that are partially contained? (That way I don't need to clip when drawing level)

Thanks!


      




More information about the Qt-interest-old mailing list