Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_tool_pencil.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2012 Sven Langkamp <sven.langkamp@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KIS_TOOL_PENCIL_H_
8#define KIS_TOOL_PENCIL_H_
9
10#include <KoPencilTool.h>
11#include <KoToolFactoryBase.h>
12
14#include "kis_tool_shape.h"
15#include "kis_delegated_tool.h"
16#include <kis_icon.h>
17
18class KoCanvasBase;
19class KisToolPencil;
20
22
24public:
26 void paint(QPainter &painter, const KoViewConverter &converter) override;
27 virtual void paintPath(KoPathShape * path, QPainter &painter, const KoViewConverter &converter);
28 void addPathShape(KoPathShape* pathShape, bool closePath) override;
29
31
32protected:
33 void slotUpdatePencilCursor() override;
34
35private:
37};
38
42
44{
45 Q_OBJECT
46
47public:
49 void mousePressEvent(KoPointerEvent *event) override;
50 // reimplementing KoToolBase's method. It ignores the event, and then
51 // Qt does not send mouseRelease event, which causes the tool to jump.
52 void mouseDoubleClickEvent(KoPointerEvent *event) override;
53
54 void beginPrimaryAction(KoPointerEvent* event) override;
55 void continuePrimaryAction(KoPointerEvent *event) override;
56 void endPrimaryAction(KoPointerEvent *event) override;
57
59
60protected Q_SLOTS:
61 void resetCursorStyle() override;
62
63private:
64 void updatePencilCursor(bool value);
65
66private:
68};
69
71{
72
73public:
75 : KisToolPaintFactoryBase("KisToolPencil") {
76 setToolTip(i18n("Freehand Path Tool"));
79 setIconName(koIconNameCStr("krita_tool_freehandvector"));
80 setPriority(9);
81 }
82
84
86 return new KisToolPencil(canvas);
87 }
88};
89
90
91
92#endif // KIS_TOOL_PENCIL_H_
93
float value(const T *src, size_t ch)
KoToolBase * createTool(KoCanvasBase *canvas) override
~KisToolPencilFactory() override
KisToolPencil(KoCanvasBase *canvas)
QList< QPointer< QWidget > > createOptionWidgets() override
void beginPrimaryAction(KoPointerEvent *event) override
void continuePrimaryAction(KoPointerEvent *event) override
void endPrimaryAction(KoPointerEvent *event) override
void updatePencilCursor(bool value)
void mousePressEvent(KoPointerEvent *event) override
void mouseDoubleClickEvent(KoPointerEvent *event) override
void resetCursorStyle() override
The position of a path point within a path shape.
Definition KoPathShape.h:63
QList< QPointer< QWidget > > createOptionWidgets() override
KoCanvasBase * canvas() const
Returns the canvas the tool is working on.
void setSection(const QString &section)
void setActivationShapeId(const QString &activationShapeId)
void setIconName(const char *iconName)
void setToolTip(const QString &tooltip)
void setPriority(int newPriority)
KisToolPencil *const m_parentTool
void addPathShape(KoPathShape *pathShape, bool closePath) override
virtual void paintPath(KoPathShape *path, QPainter &painter, const KoViewConverter &converter)
void paint(QPainter &painter, const KoViewConverter &converter) override
void slotUpdatePencilCursor() override
__KisToolPencilLocalTool(KoCanvasBase *canvas, KisToolPencil *parentTool)
#define koIconNameCStr(name)
Definition kis_icon.h:28
static const QString KRITA_TOOL_ACTIVATION_ID
Definition kis_tool.h:37
KisDelegatedTool< KisToolShape, __KisToolPencilLocalTool, DeselectShapesActivationPolicy > DelegatedPencilTool
static const QString Shape
Freehand and shapes like ellipses and lines.
KisCanvas2 * canvas