blob: 0755008c428c5f626759706b666537f6ae08dbea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <qpainter.h>
#include "field.h"
Field::Field(QWidget *parent,int i):QWidget(parent)
{
pixmap=new QPixmap(SIZE,SIZE);
number=i;
}
void Field::paintEvent(QPaintEvent*)
{
bitBlt(this,0,0,pixmap);
}
void Field::mousePressEvent(QMouseEvent* mouseevent)
{
if(mouseevent->button()!=Qt::LeftButton) return;
emit click(number);
}
void Field::draw(QImage *image)
{
QPainter paint;
paint.begin(pixmap);
paint.drawImage(0,0,*image);
paint.end();
update();
}
|