manojmka
18th December 2007, 06:13
Hi guys,
I want to have a grid on my graphicsScene of customized size. I have a serious problem with GraphicsScene background drawing. I have implemented the drawBackground() function in my graphicsScene class as follows:
painter->drawRect(rect);
if(gridSize>0)
{
painter->setOpacity(0.1);
for(int i=0;i<rect.width();i+=gridSize)
painter->drawLine(i,0,i,rect.height());
for(int i=0;i<rect.height();i+=gridSize)
painter->drawLine(0,i,rect.width(),i);
}
The grid is repainted every time I move, resize, rotate any item on the scene. And this repainting leaves some extra lines drawn on the scene?? It looks very ugly. Please help me as this is urgent!!
Regards,
Manoj
I want to have a grid on my graphicsScene of customized size. I have a serious problem with GraphicsScene background drawing. I have implemented the drawBackground() function in my graphicsScene class as follows:
painter->drawRect(rect);
if(gridSize>0)
{
painter->setOpacity(0.1);
for(int i=0;i<rect.width();i+=gridSize)
painter->drawLine(i,0,i,rect.height());
for(int i=0;i<rect.height();i+=gridSize)
painter->drawLine(0,i,rect.width(),i);
}
The grid is repainted every time I move, resize, rotate any item on the scene. And this repainting leaves some extra lines drawn on the scene?? It looks very ugly. Please help me as this is urgent!!
Regards,
Manoj