Qt Code:
  1. QImage img("lena.jpg");
  3. rotate_image_implace(img, angle); //rotate the img with angle degrees(90, 180, 270 and so on)
  5. graph_scene_ = new QGraphicsScene(this);
  6. graph_scene_->addItem(graph_pixmap_ = new QGraphicsPixmapItem);
  7. graph_view_ = new QGraphicsView(graph_scene_, this);
  9. graph_pixmap_->setPixmap(QPixmap::fromImage(img));
  10. graph_scene_->setSceneRect(img.rect());
To copy to clipboard, switch view to plain text mode 

type of graph_pixmap_ is QGraphicsPixmapItem

type of graph_scene_ is QGraphicsScene

type of graph_view_ is QGraphicsView

This may clip the image if their height and width are different, how could I rotate the image without clipping it?

Because the program need to save the image after rotating and mirror(vertical and horizontal), rotation of QGraphicsPixmapItem is not adopted.