With code1, the display looks very fine.
Qt Code:
  1. void my_graphics_view::resizeEvent(QResizeEvent *event)
  2. {
  3. setWidth(event->size().width());
  4. setHeight(event->size().height());
  5.  
  6. fitInView(QRectF(0,0,width(),height()),Qt::KeepAspectRatioByExpanding);
  7. arrangeNodes();
  8.  
  9. update();
  10. }
  11.  
  12. void my_graphics_item::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
  13. {
  14. Q_UNUSED(option);
  15.  
  16. painter->setRenderHint(QPainter::SmoothPixmapTransform);
  17. painter->setPen(QPen(Qt::red));
  18. painter->setBrush(QBrush(Qt::gray, Qt::Dense4Pattern));
  19.  
  20. painter->drawRect(draw);
  21. }
To copy to clipboard, switch view to plain text mode 

But with the following code2, the display changes:
Qt Code:
  1. void my_graphics_view::resizeEvent(QResizeEvent *event)
  2. {
  3. setWidth(event->size().width());
  4. setHeight(event->size().height());
  5.  
  6. arrangeNodes();
  7. m_scene->setSceneRect(0,0,width(),height());
  8.  
  9. update();
  10. }
  11.  
  12. void my_graphics_item::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
  13. {
  14. Q_UNUSED(option);
  15.  
  16. painter->setRenderHint(QPainter::SmoothPixmapTransform);
  17. painter->setPen(QPen(Qt::red));
  18. painter->setBrush(QBrush(Qt::gray, Qt::Dense4Pattern));
  19.  
  20. painter->drawRect(draw);
  21. }
To copy to clipboard, switch view to plain text mode 

This display of code1 and code2: