QImage image; image.load(fileName);//fileName为图片的路径 QImage result = image.scaled(800, 600).scaled(120, 180, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);//放缩图片,以固定大小显示 ImageLabel->setPixmap(QPixmap::fromImage(result));//在Label控件上显示图片
QImage image; image.load(fileName);//fileName为图片的路径 QImage result = image.scaled(800, 600).scaled(120, 180, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);//放缩图片,以固定大小显示 ImageLabel->setPixmap(QPixmap::fromImage(result));//在Label控件上显示图片
转载于:https://www.cnblogs.com/YunChao/p/5547289.html