summaryrefslogtreecommitdiff
path: root/noncore/games/kcheckers/field.cpp
Unidiff
Diffstat (limited to 'noncore/games/kcheckers/field.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/kcheckers/field.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/noncore/games/kcheckers/field.cpp b/noncore/games/kcheckers/field.cpp
new file mode 100644
index 0000000..0755008
--- a/dev/null
+++ b/noncore/games/kcheckers/field.cpp
@@ -0,0 +1,31 @@
1
2#include <qpainter.h>
3
4#include "field.h"
5
6Field::Field(QWidget *parent,int i):QWidget(parent)
7{
8 pixmap=new QPixmap(SIZE,SIZE);
9 number=i;
10}
11
12void Field::paintEvent(QPaintEvent*)
13{
14 bitBlt(this,0,0,pixmap);
15}
16
17void Field::mousePressEvent(QMouseEvent* mouseevent)
18{
19 if(mouseevent->button()!=Qt::LeftButton) return;
20 emit click(number);
21}
22
23void Field::draw(QImage *image)
24{
25 QPainter paint;
26 paint.begin(pixmap);
27 paint.drawImage(0,0,*image);
28 paint.end();
29 update();
30}
31