QImage image("c:/test.jpg");
QPixmap px = QPixmap::fromImage(image);
//图片缩放:w, h为宽高
px = px.scaled(w, h, Qt::keepAspectRatio, Qt::SmoothTransformation);
主要注意下scaled的第三个和第四个参数,Qt::KeepAspectRation是表示图片在缩放时候保持本身宽高比例,Qt::SmoothTransformtion是平滑算法,保持图片在缩放时候模糊。