Krita Source Code Documentation
Loading...
Searching...
No Matches
KoCreatePathTool.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 *
3 * SPDX-FileCopyrightText: 2006 Thorsten Zachmann <zachmann@kde.org>
4 * SPDX-FileCopyrightText: 2008-2009 Jan Hambrecht <jaham@gmx.net>
5 *
6 * SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8#ifndef KOCREATEPATHTOOL_H
9#define KOCREATEPATHTOOL_H
10
11#include "kritabasicflakes_export.h"
12
13#include <KoFlakeTypes.h>
14#include <KoToolBase.h>
15
16#include <QList>
17
18class KoPathShape;
19class KoShapeStroke;
20
22
23#define KoCreatePathTool_ID "CreatePathTool"
24
28class KRITABASICFLAKES_EXPORT KoCreatePathTool : public KoToolBase
29{
30 Q_OBJECT
31public:
36 explicit KoCreatePathTool(KoCanvasBase * canvas);
37 ~KoCreatePathTool() override;
38
39 QRectF decorationsRect() const override;
40
42 void paint(QPainter &painter, const KoViewConverter &converter) override;
43
45 void mousePressEvent(KoPointerEvent *event) override;
47 void mouseDoubleClickEvent(KoPointerEvent *event) override;
49 void mouseMoveEvent(KoPointerEvent *event) override;
51 void mouseReleaseEvent(KoPointerEvent *event) override;
52
56 bool pathStarted() const;
57
58 bool tryMergeInPathShape(KoPathShape *pathShape);
59
60 void setEnableClosePathShortcut(bool value);
61
62public Q_SLOTS:
64 void activate(const QSet<KoShape*> &shapes) override;
66 void deactivate() override;
68 void canvasResourceChanged(int key, const QVariant & res) override;
69
70Q_SIGNALS:
72
73protected:
79 virtual void addPathShape(KoPathShape* pathShape);
80
85 virtual void beginShape() {}
86 virtual void endShape() {}
87
88protected:
92 virtual void paintPath(KoPathShape& pathShape, QPainter &painter, const KoViewConverter &converter);
93
94 void handleMouseMove(const KoPointerEvent *event, bool considerDrag);
95 void endPath();
96 void endPathWithoutLastPoint();
97 void cancelPath();
98 void removeLastPoint();
99
100 bool addPathShapeImpl(KoPathShape* pathShape, bool tryMergeOnly);
101
104
105private:
106 Q_DECLARE_PRIVATE(KoCreatePathTool)
107 Q_PRIVATE_SLOT(d_func(), void angleDeltaChanged(qreal))
108 Q_PRIVATE_SLOT(d_func(), void angleSnapChanged(int))
109 Q_PRIVATE_SLOT(d_func(), void autoSmoothCurvesChanged(bool))
110};
111#endif
float value(const T *src, size_t ch)
virtual void beginShape()
void sigUpdateAutoSmoothCurvesGUI(bool value)
virtual void endShape()
The position of a path point within a path shape.
Definition KoPathShape.h:63
virtual QList< QPointer< QWidget > > createOptionWidgets()
virtual void mousePressEvent(KoPointerEvent *event)=0
virtual void mouseMoveEvent(KoPointerEvent *event)=0
virtual void activate(const QSet< KoShape * > &shapes)
virtual void canvasResourceChanged(int key, const QVariant &res)
virtual void mouseReleaseEvent(KoPointerEvent *event)=0
virtual void deactivate()
virtual QRectF decorationsRect() const
virtual void mouseDoubleClickEvent(KoPointerEvent *event)
virtual void paint(QPainter &painter, const KoViewConverter &converter)=0