Sun, 10 Jan 2021 17:21:32 +0200
work on tools
96 | 1 | #pragma once |
2 | #include "../main.h" | |
3 | ||
4 | class BaseTool : public QObject | |
5 | { | |
6 | Q_OBJECT | |
7 | ||
8 | public: | |
9 | struct MouseEventData | |
10 | { | |
11 | QMouseEvent* ev; | |
12 | Qt::KeyboardModifiers keymods; | |
13 | bool mouseMoved; | |
14 | Qt::MouseButtons releasedButtons; | |
15 | }; | |
16 | ||
17 | BaseTool(QObject* parent = nullptr); | |
18 | ||
19 | virtual QString name() const = 0; | |
20 | virtual QString toolTip() const = 0; | |
21 | virtual bool mousePressed(QMouseEvent*) { return false; } | |
22 | virtual bool mouseReleased(MouseEventData const&) { return false; } | |
23 | virtual bool mouseDoubleClicked(QMouseEvent*) { return false; } | |
24 | virtual bool mouseMoved(QMouseEvent*) { return false; } | |
25 | virtual bool keyReleased(QKeyEvent*) { return false; } | |
26 | }; |