Hi Friends,

I made a QGraphicsView of size (0, 0, 1024, 1024)
and QGraphicsScene of size (0, 0, 2048, 2048)

i drawn some grid lines on the scene using
drawForeground(QPainter *painter, const QRectF &rect)

and now to make the scene to fit with the view
i used

Qt Code:
  1. View::resizeEvent(QResizeEvent *event)
  2. {
  3. QGraphicsView::resizeEvent(event);
  4. fitInView(scene()->sceneRect(), Qt::KeepAspectRatio);
  5. }
To copy to clipboard, switch view to plain text mode 

and then i implemented zoom in the scene with

Qt Code:
  1. void View::wheelEvent(QWheelEvent *e)
  2. {
  3.  
  4. qreal factor = pow((double)2, -e->delta() / 240.0);
  5.  
  6. zoom(factor);
  7. }
  8.  
  9. void View::zoom(qreal factor)
  10. {
  11.  
  12.  
  13. scale(factor, factor);
  14.  
  15. }
To copy to clipboard, switch view to plain text mode 

this zooming is not working for enlarging .
if i remove the fitInView it allowing to zoom but scene looks bigger than view .

Please help me

Thanks in Advance