QT-标签显示位图

建立一个无UI的widget类:

main.cpp:

#include "widget.h"
#include <QApplication>
#include<QLabel>
#include<QImage>
 
 
 
 
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget w;
    QLabel *label=new QLabel(&w);
    QImage image("C:/Users/dyg/Desktop/QT/img.jpg");
label->setPixmap(QPixmap::fromImage(image));
label->setGeometry(0,0,image.width(),image.height());
    w.show();
    return a.exec();
}
 
 

猜你喜欢

转载自blog.csdn.net/lannister_awalys_pay/article/details/80951274
今日推荐