Mon, 26 Jul 2021 11:50:45 +0300
refactor
96 | 1 | #pragma once |
100 | 2 | #include <QMouseEvent> |
96 | 3 | #include "../main.h" |
104 | 4 | #include "../ui/canvas.h" |
96 | 5 | |
111
1f42c03fafca
Draw tool actually adds objects now
Teemu Piippo <teemu@hecknology.net>
parents:
109
diff
changeset
|
6 | class Document; |
1f42c03fafca
Draw tool actually adds objects now
Teemu Piippo <teemu@hecknology.net>
parents:
109
diff
changeset
|
7 | |
96 | 8 | class BaseTool : public QObject |
9 | { | |
10 | Q_OBJECT | |
11 | ||
12 | public: | |
13 | BaseTool(QObject* parent = nullptr); | |
14 | ||
15 | virtual QString name() const = 0; | |
16 | virtual QString toolTip() const = 0; | |
17 | virtual bool mousePressed(QMouseEvent*) { return false; } | |
111
1f42c03fafca
Draw tool actually adds objects now
Teemu Piippo <teemu@hecknology.net>
parents:
109
diff
changeset
|
18 | virtual bool mouseClick(Document*, Canvas*) { return false; } |
96 | 19 | virtual bool mouseDoubleClicked(QMouseEvent*) { return false; } |
111
1f42c03fafca
Draw tool actually adds objects now
Teemu Piippo <teemu@hecknology.net>
parents:
109
diff
changeset
|
20 | virtual bool mouseMove(Document*, Canvas*) { return false; } |
96 | 21 | virtual bool keyReleased(QKeyEvent*) { return false; } |
106 | 22 | virtual void reset() {} |
109
40a1cf2f38f5
replaced preview layers in favor of overpainting callback
Teemu Piippo <teemu@hecknology.net>
parents:
108
diff
changeset
|
23 | virtual void overpaint(Canvas*, QPainter*) const {} |
96 | 24 | }; |
103 | 25 |