src/tools/basetool.h

Sun, 13 Mar 2022 20:11:06 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 13 Mar 2022 20:11:06 +0200
changeset 181
79de20dc6a1e
parent 163
36ea1a8aee33
child 185
a38a0eb007b0
permissions
-rw-r--r--

fix build

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

class Document;

class BaseTool : public QObject
{
	Q_OBJECT

public:
	BaseTool(Document* document);

	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 {}
	virtual QString iconName() const;
protected:
	QWidget* const parentWidget;
	Document* const document;
};

mercurial