src/tools/drawtool.h

Sat, 05 Mar 2022 12:47:10 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 05 Mar 2022 12:47:10 +0200
changeset 159
1a04364d20b5
parent 152
03f8e6d42e13
child 163
36ea1a8aee33
permissions
-rw-r--r--

fix crash when loading a file
`object` is moved so we cannot access it after moving

#pragma once
#include "basetool.h"

class DrawTool : public BaseTool
{
	Q_OBJECT

public:
	Q_INVOKABLE DrawTool(Document* document);

	QString name() const override;
	QString toolTip() const override;
	bool mouseClick(Document* document, Canvas* canvas, QMouseEvent* event) override;
	bool mouseMove(Document* document, Canvas* canvas, QMouseEvent* event) override;
	bool keyReleased(Document*, Canvas* canvas, QKeyEvent* event) override;
	void reset() override;
	void overpaint(Canvas*, QPainter*) const override;
private:
	void closeShape(Document *document);
	std::vector<glm::vec3> polygon;
	std::vector<glm::vec3> previewPolygon;
	glm::vec3 previewPoint;
	bool isconcave = false;
	void updatePreviewPolygon();
};

mercurial