您的位置:首页 > 编程语言 > Qt开发

Qt在Label上显示图片

2014-06-06 21:38 225 查看
/构造函数中声明QLabel QPainter QImage   

QLabel *label->setGeometry(16,22,320,240);
  

QPainter *painter = new QPainter(label);   

QImage *image = new QImage(image,320,240,QImage::Format_RGB888);
  
<
4000
li class="alt" style="margin:0px;padding:0px 0px 0px 10px;border-width:0px 0px 0px 1px;border-left-style:solid;border-left-color:rgb(209,215,220);text-align:left;list-style:disc;line-height:18px;color:rgb(102,102,102);">
  

//显示时调用   

image->load(“./img3.jpg”);//显示图片文件   

label->setPixmap(QPixmap::fromImage(*image,Qt::AutoColor)); 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: