PDA

View Full Version : QGraphicsItem being cut when the Item is partially Out Of GraphicsView



gopikrishnav
22nd April 2010, 06:26
Hi,

I tried to draw a group of cutomized Line Items derived from QGraphicItem. When all the Items fit in the view, it is OK. However, when we do Zoom IN operation, then the Item that is half the way out of the view, is not being painted.

To avoid this, I tried to make the exposedRect equal to boundingrect in the Paint Method of my customized GraphicItem Class.

However there is no luck. It didn't serve the purpose. Can any one help me to resolve this issue.


Thanks in Advance
Gopikrishna

JohannesMunk
22nd April 2010, 15:06
Hi Gopikrishna!

Have you set your boundingRect correctly in item coordinates?

Could you post your code, preferably something small that compiles :->

Johannes

gopikrishnav
23rd April 2010, 03:27
Hi Johannes,

It seems that the bounding rect is correct I will just send the source code soon.

Thnaks for your time.

Gopi

gopikrishnav
26th April 2010, 04:15
Dear All,

At last I was able to solve the problem using the QPainter::drawPolyLine() API.
This will club all the Lines in to a Polygon. This is slightly different from the Class QGraphicsPolyginItem. QPolygonItem will fill the item and join the first and last points.

So, I thought of sharing this with you all.

Thanks for your support.:)


Gopi