赞
踩
1、Label控件动态显示图片
- //动态显示图片1
- int DeviceEdit::OnLensPic(bool checked)
- {
- AfCd::cd();
- QImage img;
- img.load("UI/lens.bmp");
- QImage imgScaled;
- imgScaled = img.scaled(ui.labelPic->size(), Qt::KeepAspectRatio);//默认保持原图的宽高比 以label大小为大小
- ui.labelPic->setPixmap(QPixmap::fromImage(imgScaled));
- return 0;
- }
-
- //动态显示图片1-无锯齿
- int DeviceEdit::OnLensPic(bool checked)
- {
- string strpath = m_strPathImages + "\\menu.png";
- ui.label_shengchan->setFixedSize(45, 45);
- ui.label_shengchan->setScaledContents(true);
- QPixmap topMsgIcon(GBK::ToUnicode(strpath));
- ui.label_shengchan->setPixmap(topMsgIcon);
- }
2、 Label控件设计界面显示图片
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。