#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QPixmap>
#include<mythread.h>
#include<QThreadPool>
#include<QPainter>
#include<QTimer>
#define REPAINT_TIME 200
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
pixmap=new QPixmap(this->size());
pixmap->fill(Qt::white);
myThread *m0=new myThread(pixmap);
QThreadPool::globalInstance()->start(m0);
//connect(m0,SIGNAL(rep()),this,SLOT(repaint()));
QTimer *qt0=new QTimer();
qt0->setInterval(REPAINT_TIME);
connect(qt0,SIGNAL(timeout()),this,SLOT(onTimeOut()));
//qt0->start();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::paintEvent(QPaintEvent *event){
QPainter painter(this);
painter.drawPixmap(0,0,*pixmap,0,0,0,0);
}