QLabel加载图片

来源:互联网 发布:telnet ip加端口不通 编辑:程序博客网 时间:2024/06/05 20:37


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);.

0 0