Tue, 28 Sep 2021 22:14:00 +0300
Fix memory corruption involving document tools.
I don't think that the metaobject-initialization had anything to do with this
but it is a lot simpler without it anyway.
#pragma once #include <QMouseEvent> #include "../main.h" #include "../ui/canvas.h" class Document; class BaseTool : public QObject { Q_OBJECT public: BaseTool(Model* model, QWidget* 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 {} protected: QWidget* const parentWidget; };