src/tools/basetool.h

Sun, 25 Jul 2021 20:39:21 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 25 Jul 2021 20:39:21 +0300
changeset 112
5760cbb32bc0
parent 111
1f42c03fafca
child 121
000781318c36
permissions
-rw-r--r--

use QT_NO_KEYWORDS

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

class Document;

class BaseTool : public QObject
{
	Q_OBJECT

public:
	BaseTool(QObject* parent = nullptr);

	virtual QString name() const = 0;
	virtual QString toolTip() const = 0;
	virtual bool mousePressed(QMouseEvent*) { return false; }
	virtual bool mouseClick(Document*, Canvas*) { return false; }
	virtual bool mouseDoubleClicked(QMouseEvent*) { return false; }
	virtual bool mouseMove(Document*, Canvas*) { return false; }
	virtual bool keyReleased(QKeyEvent*) { return false; }
	virtual void reset() {}
	virtual void overpaint(Canvas*, QPainter*) const {}
};

mercurial