src/tools/basetool.h

Mon, 19 Jul 2021 23:41:52 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Mon, 19 Jul 2021 23:41:52 +0300
changeset 105
6ca6e8c647d4
parent 104
cd4df75924b7
child 106
128efb9d148b
permissions
-rw-r--r--

added preview layer code and fixed build warnings

96
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
100
43ce3672648a fix build
Teemu Piippo <teemu@hecknology.net>
parents: 96
diff changeset
2 #include <QMouseEvent>
96
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 #include "../main.h"
104
cd4df75924b7 Add connections
Teemu Piippo <teemu@hecknology.net>
parents: 103
diff changeset
4 #include "../ui/canvas.h"
96
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 class BaseTool : public QObject
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 {
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 Q_OBJECT
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 public:
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 BaseTool(QObject* parent = nullptr);
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 virtual QString name() const = 0;
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 virtual QString toolTip() const = 0;
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 virtual bool mousePressed(QMouseEvent*) { return false; }
104
cd4df75924b7 Add connections
Teemu Piippo <teemu@hecknology.net>
parents: 103
diff changeset
16 virtual bool mouseClick(const Canvas::MouseClickInfo&) { return false; }
96
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 virtual bool mouseDoubleClicked(QMouseEvent*) { return false; }
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 virtual bool mouseMoved(QMouseEvent*) { return false; }
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 virtual bool keyReleased(QKeyEvent*) { return false; }
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 };
103
Teemu Piippo <teemu@hecknology.net>
parents: 100
diff changeset
21

mercurial