原文地址::https://blog.csdn.net/mangobar/article/details/52525555
-
QRect rect;
-
MyLabel *pLabel = new MyLabel(ui->scrollAreaWidgetContents);
-
rect.setX(x);
-
rect.setY(y);
-
rect.setWidth(320);
-
rect.setHeight(320);
-
pLabel->setGeometry(rect);
-
QString path = QString(":/new/prefix1/1234.jpg")
-
QPixmap px;
-
px.load(path);
-
pLabel->setPixmap(px);
-
pLabel->setScaledContents(true);
-
pLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); //设置外观
-
pLabel->setScaledContents(true);
-
pLabel->setVisible(true);
-
.