summaryrefslogtreecommitdiff
path: root/noncore/games/kcheckers/field.cpp
Side-by-side diff
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 @@
+
+#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();
+}
+