src/tools/drawtool.h

Thu, 03 Mar 2022 21:13:16 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 03 Mar 2022 21:13:16 +0200
changeset 151
e628fc2e0c72
parent 143
7b62c52835a1
child 152
03f8e6d42e13
permissions
-rw-r--r--

Clean up Model

96
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include "basetool.h"
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 class DrawTool : public BaseTool
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 Q_OBJECT
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 public:
143
7b62c52835a1 Fix memory corruption involving document tools.
Teemu Piippo <teemu@hecknology.net>
parents: 126
diff changeset
9 Q_INVOKABLE DrawTool(Model* model, QWidget* parent = nullptr);
96
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10
105
6ca6e8c647d4 added preview layer code and fixed build warnings
Teemu Piippo <teemu@hecknology.net>
parents: 104
diff changeset
11 QString name() const override;
6ca6e8c647d4 added preview layer code and fixed build warnings
Teemu Piippo <teemu@hecknology.net>
parents: 104
diff changeset
12 QString toolTip() const override;
121
000781318c36 added right click support for draw tool
Teemu Piippo <teemu@hecknology.net>
parents: 111
diff changeset
13 bool mouseClick(Document* document, Canvas* canvas, QMouseEvent* event) override;
000781318c36 added right click support for draw tool
Teemu Piippo <teemu@hecknology.net>
parents: 111
diff changeset
14 bool mouseMove(Document* document, Canvas* canvas, QMouseEvent* event) override;
125
f127982d3412 Move tools under Document instead of MainWindow
Teemu Piippo <teemu@hecknology.net>
parents: 124
diff changeset
15 bool keyReleased(Document*, Canvas* canvas, QKeyEvent* event) override;
106
128efb9d148b work on draw preview
Teemu Piippo <teemu@hecknology.net>
parents: 105
diff changeset
16 void reset() override;
109
40a1cf2f38f5 replaced preview layers in favor of overpainting callback
Teemu Piippo <teemu@hecknology.net>
parents: 108
diff changeset
17 void overpaint(Canvas*, QPainter*) const override;
106
128efb9d148b work on draw preview
Teemu Piippo <teemu@hecknology.net>
parents: 105
diff changeset
18 private:
111
1f42c03fafca Draw tool actually adds objects now
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
19 void closeShape(Document *document);
106
128efb9d148b work on draw preview
Teemu Piippo <teemu@hecknology.net>
parents: 105
diff changeset
20 std::vector<glm::vec3> polygon;
109
40a1cf2f38f5 replaced preview layers in favor of overpainting callback
Teemu Piippo <teemu@hecknology.net>
parents: 108
diff changeset
21 std::vector<glm::vec3> previewPolygon;
40a1cf2f38f5 replaced preview layers in favor of overpainting callback
Teemu Piippo <teemu@hecknology.net>
parents: 108
diff changeset
22 glm::vec3 previewPoint;
122
b54b350dff5d Show concave polygons as red while drawing
Teemu Piippo <teemu@hecknology.net>
parents: 121
diff changeset
23 bool isconcave = false;
121
000781318c36 added right click support for draw tool
Teemu Piippo <teemu@hecknology.net>
parents: 111
diff changeset
24 void updatePreviewPolygon();
96
165777a20dc7 added tool base code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 };

mercurial