QPixmap用于表示一个图片,支持png和jpg格式的加载
QPixmap pm("C:/test.png");
或
QPixmap pm;
pm.load("C:/test.png");
QPainter painter(this);
int width=this->width();
int height = this->height();
QRect target (0,0,wtdth/2,height/2);
QRect target(0,0,width,height);
QPixmap m_picture;
m_picture.load("C>/qt.jpg");
int w=m_picture.width();
int h=m_picture.height();
QRect source(0,0,w,h);
painter.drawPixmap(target,m_picture,source);