Qt的图片和label互相适应的两种方式

    科技2022-08-08  108

    img = img.scaled(ui.label->width(), ui.label->height(), Qt::KeepAspectRatio);

    上面这种是图片适应label

    img = img.scaled(ui.label->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);

    这种是label适应于图片(在定位图像坐标的时候有用)

    Processed: 0.009, SQL: 8