PDA

View Full Version : QGraphicsItem - painting problem for zoomin



nileshsince1980
26th March 2010, 09:02
Hi All,
In my application I am using QGraphicsView/Scene architecture. The application has n number of rectangle item ( QGraphicsItem) and the there are n number of lines (QGraphicsLineItem) drawn between these rect items. I am using QT 4.5.1 on Windows XP. I am facing following 2 problems,

1. Initial drawing of items is fine. To speed up rect iitem drawing I am using following code in painting of rect item



painter->setPen(Qt::black);
painter->setBrush(brush);
if (option->levelOfDetail > 2.)
painter->drawRects(&squareRect, 1);
} else
painter->fillRect(squareRect, brush);


The problem with this is when the levelOfDetails > 2., painter->drawRects(..) is not getting called, so I am not able to see the border around it. Just painter->fillRect(..) getting called. This is working fine for Debug version but for Release it not working as per expected.

2. When I set line width to 1 and do zoom in operation, then after some zoomin operation I am getting a Square Rect of Line color is getting drawn where there are lot of lines getting overlapped. It works fine if I have 0 width for line.

Please tell the solution for above problem.

Thanks in Advance.


Thanks,
Nilesh