Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_tool_select_path.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2007 Sven Langkamp <sven.langkamp@gmail.com>
3 * SPDX-FileCopyrightText: 2015 Michael Abrahams <miabraha@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8#ifndef KIS_TOOL_SELECT_PATH_H_
9#define KIS_TOOL_SELECT_PATH_H_
10
11#include <KoCreatePathTool.h>
14#include "kis_delegated_tool.h"
15
16#include <kis_icon.h>
17
18class KoCanvasBase;
20
21
23public:
25 void paintPath(KoPathShape &path, QPainter &painter, const KoViewConverter &converter) override;
26 void addPathShape(KoPathShape* pathShape) override;
27
33
34private:
36
37 void beginShape() override;
38 void endShape() override;
39};
40
43
46 const QCursor &cursor,
47 KoToolBase *delegateTool)
48 : DelegatedSelectPathTool(canvas, cursor, dynamic_cast<__KisToolSelectPathLocalTool*>(delegateTool))
49 {
50 Q_ASSERT(dynamic_cast<__KisToolSelectPathLocalTool*>(delegateTool));
51 }
52
53 // If an event is explicitly forwarded only as an action (e.g. shift-click is captured by "change size")
54 // we will receive a primary action but no mousePressEvent. Thus these events must be explicitly forwarded.
55 void beginPrimaryAction(KoPointerEvent *event) override;
56 void continuePrimaryAction(KoPointerEvent *event) override;
57 void endPrimaryAction(KoPointerEvent *event) override;
59
60
61 void mousePressEvent(KoPointerEvent *event) override;
62 void mouseMoveEvent(KoPointerEvent *event) override;
63 void mouseReleaseEvent(KoPointerEvent *event) override;
64 void mouseDoubleClickEvent(KoPointerEvent *event) override;
65};
66
67
68class KisToolSelectPath : public KisToolSelectBase<KisDelegatedSelectPathWrapper>
69{
70 Q_OBJECT
71public:
73 bool eventFilter(QObject *obj, QEvent *event) override;
74 void resetCursorStyle() override;
75
76protected:
77 void requestStrokeCancellation() override;
78 void requestStrokeEnd() override;
81};
82
84{
85public:
87 : KisSelectionToolFactoryBase("KisToolSelectPath") {
88 setToolTip(i18n("Bezier Curve Selection Tool"));
91 setIconName(koIconNameCStr("tool_path_selection"));
92 setPriority(6);
93 }
94
96
98 return new KisToolSelectPath(canvas);
99 }
100
101
102};
103
104
105
106#endif // KIS_TOOL_SELECT_PATH_H_
KoToolBase * createTool(KoCanvasBase *canvas) override
QList< QPointer< QWidget > > createOptionWidgets() override
void requestStrokeEnd() override
void requestStrokeCancellation() override
void resetCursorStyle() override
KisToolSelectPath(KoCanvasBase *canvas)
bool eventFilter(QObject *obj, QEvent *event) override
QList< QPointer< QWidget > > createOptionWidgets() override
reimplemented
The position of a path point within a path shape.
Definition KoPathShape.h:63
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)
KisToolSelectPath *const m_selectionTool
void addPathShape(KoPathShape *pathShape) override
__KisToolSelectPathLocalTool(KoCanvasBase *canvas, KisToolSelectPath *parentTool)
void paintPath(KoPathShape &path, QPainter &painter, const KoViewConverter &converter) override
#define koIconNameCStr(name)
Definition kis_icon.h:28
static const QString KRITA_TOOL_ACTIVATION_ID
Definition kis_tool.h:37
KisDelegatedTool< KisTool, __KisToolSelectPathLocalTool, DeselectShapesActivationPolicy > DelegatedSelectPathTool
static const QString Select
Tools that select pixels.
void mousePressEvent(KoPointerEvent *event) override
void beginPrimaryAction(KoPointerEvent *event) override
void endPrimaryAction(KoPointerEvent *event) override
void continuePrimaryAction(KoPointerEvent *event) override
void mouseReleaseEvent(KoPointerEvent *event) override
void mouseDoubleClickEvent(KoPointerEvent *event) override
KisDelegatedSelectPathWrapper(KoCanvasBase *canvas, const QCursor &cursor, KoToolBase *delegateTool)
void beginPrimaryDoubleClickAction(KoPointerEvent *event) override
void mouseMoveEvent(KoPointerEvent *event) override
KisCanvas2 * canvas