-
Notifications
You must be signed in to change notification settings - Fork 0
/
scribblearea.h
56 lines (42 loc) · 1.26 KB
/
scribblearea.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef SCRIBBLEAREA_H
#define SCRIBBLEAREA_H
#include <QColor>
#include <QImage>
#include <QPoint>
#include <QWidget>
class PointQuadtree;
class ScribbleArea : public QWidget
{
Q_OBJECT
public:
ScribbleArea(QWidget *parent = 0);
QPainter *tmppainter;
void setPenColor(const QColor &newColor);
void setPenWidth(int newWidth);
bool isModified() const { return modified; }
QColor penColor() const { return myPenColor; }
int penWidth() const { return myPenWidth; }
public slots:
void clearImage();
void print();
void random(int N);
void selection(int R);
protected:
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
private:
void drawCircle(const QPoint &endPoint);
void drawLineTo(const QPoint &endPoint);
void resizeImage(QImage *image, const QSize &newSize);
bool modified;
bool scribbling;
bool select;
int myPenWidth;
QColor myPenColor;
QImage image;
QPoint lastPoint;
};
#endif