#include "widget.h"
#include "ui_widget.h"
#include<QPainter>
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
this->resize(800,600);
}
Widget::~Widget()
{
delete ui;
}
void Widget::paintEvent(QPaintEvent *event)
{
QPainter *p=new QPainter(this);
QPixmap pp;
pp.load(":/image/b6.png");
pp.scaled(this->width(),this->height());//调整图片大小
p->drawPixmap(0,0,this->width(),this->height(),pp);
}