hi friends,

I just drawn grid lines in the QGraphicsView on its

Qt Code:
  1. drawbackground(QPainter *painter, const QRectF &rect)
  2. {
  3. QVarLengthArray<QLineF, 100> linesX;
  4. for (qreal x = left; x < sceneRect.right(); x += gridInterval )
  5. {
  6.  
  7. linesX.append(QLineF(x, sceneRect.top(), x, sceneRect.bottom()));
  8. }
  9.  
  10. QVarLengthArray<QLineF, 100> linesY;
  11. for (qreal y = top; y < sceneRect.bottom(); y += gridInterval ){
  12.  
  13. linesY.append(QLineF(sceneRect.left(), y, sceneRect.right(), y));
  14. }
  15.  
  16. painter->drawLines(linesX.data(), linesX.size());
  17. painter->drawLines(linesY.data(), linesY.size());
  18. }
To copy to clipboard, switch view to plain text mode 

and im scaling the view by
Qt Code:
  1. wheelEvent(QWheelEvent *event)
  2. {
  3. if(event->modifiers().testFlag(Qt::ControlModifier))
  4. {
  5. int numSteps = event->delta() / 15/ 8;
  6.  
  7. if (numSteps == 0)
  8. {
  9. event->ignore();
  10. return;
  11. }
  12.  
  13. qreal sc = pow(1.25, numSteps);
  14. QRectF r(0, 0, 1, 1);
  15. qreal factor = transform().scale(scaleFactor, scaleFactor).mapRect(r).width();
  16.  
  17. if(factor < 1)
  18. return;
  19.  
  20. this->scale(scaleFactor, scaleFactor);
  21. event->accept();
  22. }
  23. }
To copy to clipboard, switch view to plain text mode 

now how i can ignore the grid lines not to be scaled .
as u can see even the grid lines also getting scaled every time i zoom .
if it is a graphicsItem i can use ignore transform but for normal painter ..?

i tried QPainter::resetTransform() but in vain ..

Please help me ..