e567eba26
김태훈
터치 테스트 윈도우 구현
|
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
|
#ifndef CANVAS_H
#define CANVAS_H
#include <QWidget>
#include <QImage>
#include <QPoint>
class Canvas : public QWidget
{
Q_OBJECT
public:
explicit Canvas(QWidget *parent = 0);
signals:
public slots:
void clearImage();
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 drawLineTo(const QPoint &endPoint);
void resizeImage(QImage *image, const QSize &newSize);
bool scribbling;
int myPenWidth;
QColor myPenColor;
QImage image;
QPoint lastPoint;
};
#endif // CANVAS_H
|