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);
}
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);
}
To copy to clipboard, switch view to plain text mode
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
Bookmarks