img = img.scaled(ui.label->width(), ui.label->height(), Qt::KeepAspectRatio);
上面这种是图片适应label
img = img.scaled(ui.label->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
这种是label适应于图片(在定位图像坐标的时候有用)
img = img.scaled(ui.label->width(), ui.label->height(), Qt::KeepAspectRatio);
上面这种是图片适应label
img = img.scaled(ui.label->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
这种是label适应于图片(在定位图像坐标的时候有用)