1 水平翻转 2 void ImageViewer::horFilp() 3 { 4 image = image.mirrored(true, false); 5 imageLabel->setPixmap(QPixmap::fromImage(image)); 6 } 7 垂直翻转 8 void ImageViewer::verFilp() 9 { 10 image = image.mirrored(false, true); 11 imageLabel->setPixmap(QPixmap::fromImage(image)); 12 } 13 顺时针旋转 14 void ImageViewer::clockwise() 15 { 16 QMatrix matrix; 17 matrix.rotate(90.0); 18 image = image.transformed(matrix,Qt::FastTransformation); 19 imageLabel->setPixmap(QPixmap::fromImage(image)); 20 } 21 逆时针旋转 22 void ImageViewer::anticlockwise() 23 { 24 QMatrix matrix; 25 matrix.rotate(-90.0); 26 image = image.transformed(matrix,Qt::FastTransformation); 27 imageLabel->setPixmap(QPixmap::fromImage(image)); 28 }