After put a rectangle in a QGraphicsScene and make it movable with the mouse, how could I resize it with the mouse?

If no one knows an answer, a example could be good too, I'm developing in Python using PYQt4, but the example can be in C++.

My simplified code:

Qt Code:
  1. import sys
  2. from PyQt4.QtCore import *
  3. from PyQt4.QtGui import *
  4.  
  5. app = QApplication(sys.argv)
  6.  
  7. grview = QGraphicsView()
  8. scene = QGraphicsScene()
  9. scene.setSceneRect(0, 0, 512, 512)
  10.  
  11. scene.addPixmap(QPixmap('01.png'))
  12. grview.setScene(scene)
  13.  
  14. item = QGraphicsRectItem(0, 0, 300, 150)
  15.  
  16. pen = QPen(Qt.darkMagenta)
  17. pen.setWidth(4)
  18. item.setPen(pen)
  19.  
  20. item.setFlag(QGraphicsItem.ItemIsMovable)
  21. scene.addItem(item)
  22.  
  23. grview.fitInView(scene.sceneRect(), Qt.KeepAspectRatio)
  24.  
  25. grview.show()
  26.  
  27. sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode