-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcanvas.hpp
More file actions
58 lines (37 loc) · 836 Bytes
/
canvas.hpp
File metadata and controls
58 lines (37 loc) · 836 Bytes
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
57
58
#ifndef CANVAS_HPP
#define CANVAS_HPP
#include <QWidget>
#include <QMouseEvent>
#include <QApplication>
class ScrollArea;
class DCanvas;
#include <adaptinktool.hpp>
class Canvas final : public QWidget
{
Q_OBJECT
public:
explicit Canvas(QWidget *parent = nullptr);
~Canvas() = default;
void setPaintColor(QColor color);
void setTool(AdaptinkTool tool);
void setPixmap(QPixmap pixmap);
QPixmap getPixmap();
signals:
public slots:
void setToolSize(int size);
protected:
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void paintEvent(QPaintEvent* event);
private:
void draw();
bool m_repaintToSave;
AdaptinkTool m_tool;
QPoint m_old_mouse_pos;
QPoint m_mouse_pos;
QPixmap m_pixmap;
QColor m_color;
QSize m_tool_size;
friend class DCanvas;
};
#endif // CANVAS_HPP