Krita Source Code Documentation
Loading...
Searching...
No Matches
KisToolPath Class Reference

#include <kis_tool_path.h>

+ Inheritance diagram for KisToolPath:

Public Member Functions

void beginAlternateAction (KoPointerEvent *event, AlternateAction action) override
 
void beginPrimaryAction (KoPointerEvent *event) override
 
void beginPrimaryDoubleClickAction (KoPointerEvent *event) override
 
void continuePrimaryAction (KoPointerEvent *event) override
 
QList< QPointer< QWidget > > createOptionWidgets () override
 
void endPrimaryAction (KoPointerEvent *event) override
 
bool eventFilter (QObject *obj, QEvent *event) override
 
 KisToolPath (KoCanvasBase *canvas)
 
void mousePressEvent (KoPointerEvent *event) override
 
KisPopupWidgetInterfacepopupWidget () override
 
- Public Member Functions inherited from KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >
void activate (const QSet< KoShape * > &shapes) override
 
QList< QPointer< QWidget > > createOptionWidgets () override
 
void deactivate () override
 
 KisDelegatedTool (KoCanvasBase *canvas, const QCursor &cursor, DelegateTool *delegateTool)
 
DelegateTool * localTool () const
 
void mouseDoubleClickEvent (KoPointerEvent *event) override
 
void mouseMoveEvent (KoPointerEvent *event) override
 
void mousePressEvent (KoPointerEvent *event) override
 
void mouseReleaseEvent (KoPointerEvent *event) override
 
void paint (QPainter &painter, const KoViewConverter &converter) override
 

Protected Slots

void resetCursorStyle () override
 

Protected Member Functions

void requestStrokeCancellation () override
 
void requestStrokeEnd () override
 

Friends

class __KisToolPathLocalTool
 

Additional Inherited Members

- Protected Attributes inherited from KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >
QScopedPointer< DelegateTool > m_localTool
 

Detailed Description

Definition at line 43 of file kis_tool_path.h.

Constructor & Destructor Documentation

◆ KisToolPath()

KisToolPath::KisToolPath ( KoCanvasBase * canvas)

Definition at line 17 of file kis_tool_path.cc.

18 : DelegatedPathTool(canvas, Qt::ArrowCursor,
19 new __KisToolPathLocalTool(canvas, this))
20{
21 setIsOpacityPresetMode(true);
22 KisCanvas2 *kritaCanvas = dynamic_cast<KisCanvas2*>(canvas);
23
24 connect(kritaCanvas->viewManager()->canvasResourceProvider(), SIGNAL(sigEffectiveCompositeOpChanged()), SLOT(resetCursorStyle()));
25
26}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisViewManager * viewManager() const
friend class __KisToolPathLocalTool
void resetCursorStyle() override
KisCanvasResourceProvider * canvasResourceProvider()
KisDelegatedTool< KisToolShape, __KisToolPathLocalTool, DeselectShapesActivationPolicy > DelegatedPathTool

References KisViewManager::canvasResourceProvider(), connect(), resetCursorStyle(), and KisCanvas2::viewManager().

Member Function Documentation

◆ beginAlternateAction()

void KisToolPath::beginAlternateAction ( KoPointerEvent * event,
AlternateAction action )
override

Definition at line 85 of file kis_tool_path.cc.

85 {
86 DelegatedPathTool::beginAlternateAction(event, action);
87 if (!nodeEditable()) return;
88
89 if (nodePaintAbility() == KisToolPath::MYPAINTBRUSH_UNPAINTABLE) {
90 KisCanvas2 * kiscanvas = static_cast<KisCanvas2*>(canvas());
91 QString message = i18n("The MyPaint Brush Engine is not available for this colorspace");
92 kiscanvas->viewManager()->showFloatingMessage(message, koIcon("object-locked"));
93 event->ignore();
94 return;
95 }
96}
void showFloatingMessage(const QString &message, const QIcon &icon, int timeout=4500, KisFloatingMessage::Priority priority=KisFloatingMessage::Medium, int alignment=Qt::AlignCenter|Qt::TextWordWrap)
shows a floating message in the top right corner of the canvas
#define koIcon(name)
Use these macros for icons without any issues.
Definition kis_icon.h:25

References koIcon, KisViewManager::showFloatingMessage(), and KisCanvas2::viewManager().

◆ beginPrimaryAction()

void KisToolPath::beginPrimaryAction ( KoPointerEvent * event)
override

Definition at line 98 of file kis_tool_path.cc.

99{
100 if (!nodeEditable()) return;
102}
void mousePressEvent(KoPointerEvent *event) override

References KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >::mousePressEvent().

◆ beginPrimaryDoubleClickAction()

void KisToolPath::beginPrimaryDoubleClickAction ( KoPointerEvent * event)
override

◆ continuePrimaryAction()

void KisToolPath::continuePrimaryAction ( KoPointerEvent * event)
override

Definition at line 104 of file kis_tool_path.cc.

105{
106 mouseMoveEvent(event);
107}
void mouseMoveEvent(KoPointerEvent *event) override

References KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >::mouseMoveEvent().

◆ createOptionWidgets()

QList< QPointer< QWidget > > KisToolPath::createOptionWidgets ( )
override

Definition at line 119 of file kis_tool_path.cc.

120{
122 return widgets;
123}
QList< QPointer< QWidget > > createOptionWidgets() override

References KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >::createOptionWidgets().

◆ endPrimaryAction()

void KisToolPath::endPrimaryAction ( KoPointerEvent * event)
override

Definition at line 109 of file kis_tool_path.cc.

110{
111 mouseReleaseEvent(event);
112}
void mouseReleaseEvent(KoPointerEvent *event) override

References KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >::mouseReleaseEvent().

◆ eventFilter()

bool KisToolPath::eventFilter ( QObject * obj,
QEvent * event )
override

Definition at line 62 of file kis_tool_path.cc.

63{
64 Q_UNUSED(obj);
65 if (!localTool()->pathStarted()) {
66 return false;
67 }
68 if (event->type() == QEvent::MouseButtonPress ||
69 event->type() == QEvent::MouseButtonDblClick) {
70 QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
71 if (mouseEvent->button() == Qt::RightButton) {
72 localTool()->removeLastPoint();
73 return true;
74 }
75 } else if (event->type() == QEvent::TabletPress) {
76 QTabletEvent *tabletEvent = static_cast<QTabletEvent*>(event);
77 if (tabletEvent->button() == Qt::RightButton) {
78 localTool()->removeLastPoint();
79 return true;
80 }
81 }
82 return false;
83}
DelegateTool * localTool() const

References KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >::localTool().

◆ mousePressEvent()

void KisToolPath::mousePressEvent ( KoPointerEvent * event)
override

Definition at line 54 of file kis_tool_path.cc.

55{
56 Q_UNUSED(event)
57}

◆ popupWidget()

KisPopupWidgetInterface * KisToolPath::popupWidget ( )
override

Definition at line 49 of file kis_tool_path.cc.

50{
51 return localTool()->pathStarted() ? nullptr : DelegatedPathTool::popupWidget();
52}

References KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >::localTool().

◆ requestStrokeCancellation()

void KisToolPath::requestStrokeCancellation ( )
overrideprotected

Definition at line 44 of file kis_tool_path.cc.

45{
46 localTool()->cancelPath();
47}

References KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >::localTool().

◆ requestStrokeEnd()

void KisToolPath::requestStrokeEnd ( )
overrideprotected

Definition at line 39 of file kis_tool_path.cc.

40{
41 localTool()->endPathWithoutLastPoint();
42}

References KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >::localTool().

◆ resetCursorStyle

void KisToolPath::resetCursorStyle ( )
overrideprotectedslot

Definition at line 28 of file kis_tool_path.cc.

29{
30 if (isEraser() && (nodePaintAbility() == PAINT)) {
31 useCursor(KisCursor::eraserCursor());
32 } else {
33 DelegatedPathTool::resetCursorStyle();
34 }
35
36 overrideCursorIfNotEditable();
37}
static QCursor eraserCursor()

References KisCursor::eraserCursor().

Friends And Related Symbol Documentation

◆ __KisToolPathLocalTool

friend class __KisToolPathLocalTool
friend

Definition at line 75 of file kis_tool_path.h.


The documentation for this class was generated from the following files: