src/tools/basetool.h

Sun, 29 Aug 2021 22:14:42 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 29 Aug 2021 22:14:42 +0300
changeset 127
f64bfb7f5d26
parent 126
a7c720aff97c
child 143
7b62c52835a1
permissions
-rw-r--r--

added a simple matrix transformation tool

#pragma once
#include <QMouseEvent>
#include "../main.h"
#include "../ui/canvas.h"

class Document;

class BaseTool : public QObject
{
	Q_OBJECT

public:
	BaseTool(Model* model, QObject* parent = nullptr);

	virtual QString name() const = 0;
	virtual QString toolTip() const = 0;
	virtual bool mouseClick(Document*, Canvas*, QMouseEvent*) { return false; }
	virtual bool mouseDoubleClicked(QMouseEvent*, QMouseEvent*) { return false; }
	virtual bool mouseMove(Document*, Canvas*, QMouseEvent*) { return false; }
	virtual bool keyReleased(Document*, Canvas*, QKeyEvent*) { return false; }
	virtual QWidget* toolWidget() { return nullptr; }
	virtual void selectionChanged(const QSet<ldraw::id_t>&) {}
	virtual void reset() {}
	virtual void overpaint(Canvas*, QPainter*) const {}
};

mercurial