PDA

View Full Version : boundingRect and QStyleOptionGraphicsItem::exposedRect precision problem



geovanyfilho
3rd February 2010, 15:50
Hi,

I create a QGraphicsItem and reimplemented the boundingRect and paint methods. My item width and height are about 0.0001. I'm using very large zoom, so I should be seeing this item, but I never get the paint method called. If I force my boundingRect method to return width and height bigger than 0.5, the paint method is called and I can see my items.
The second problem is about the QStyleOptionGraphicsItem::exposedRect. The issue is that my Item changes at real time and gets much bigger than the visible area, so I should only paint the parts of the item that is being showed, otherwise I get performance problems. I used the QGraphicsItem::ItemUsesExtendedStyleOption to get the visible area on the "option" parameter of the paint method. But I always got a exposedrect = (0, 0, 0, 0).
Does Qt uses float precision for the bounding rect and the exposed region? How do I set the precision that should be used?

thank you,