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

#include <kis_tool_pencil.h>

+ Inheritance diagram for KisToolPencil:

Public Member Functions

void beginPrimaryAction (KoPointerEvent *event) override
 
void continuePrimaryAction (KoPointerEvent *event) override
 
QList< QPointer< QWidget > > createOptionWidgets () override
 
void endPrimaryAction (KoPointerEvent *event) override
 
 KisToolPencil (KoCanvasBase *canvas)
 
void mouseDoubleClickEvent (KoPointerEvent *event) override
 
void mousePressEvent (KoPointerEvent *event) 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
 

Private Member Functions

void updatePencilCursor (bool value)
 

Friends

class __KisToolPencilLocalTool
 

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_pencil.h.

Constructor & Destructor Documentation

◆ KisToolPencil()

KisToolPencil::KisToolPencil ( KoCanvasBase * canvas)

Definition at line 19 of file kis_tool_pencil.cc.

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

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

Member Function Documentation

◆ beginPrimaryAction()

void KisToolPencil::beginPrimaryAction ( KoPointerEvent * event)
override

Definition at line 58 of file kis_tool_pencil.cc.

59{
60 if (!nodeEditable()) return;
61
62 if (nodePaintAbility() == KisToolPencil::MYPAINTBRUSH_UNPAINTABLE) {
63 KisCanvas2 * kiscanvas = static_cast<KisCanvas2*>(canvas());
64 QString message = i18n("The MyPaint Brush Engine is not available for this colorspace");
65 kiscanvas->viewManager()->showFloatingMessage(message, koIcon("object-locked"));
66 event->ignore();
67 return;
68 }
69
71}
void mousePressEvent(KoPointerEvent *event) override
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, KisDelegatedTool< BaseClass, DelegateTool, ActivationPolicy >::mousePressEvent(), KisViewManager::showFloatingMessage(), and KisCanvas2::viewManager().

◆ continuePrimaryAction()

void KisToolPencil::continuePrimaryAction ( KoPointerEvent * event)
override

Definition at line 73 of file kis_tool_pencil.cc.

74{
75 mouseMoveEvent(event);
76}
void mouseMoveEvent(KoPointerEvent *event) override

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

◆ createOptionWidgets()

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

Definition at line 83 of file kis_tool_pencil.cc.

84{
85 QList<QPointer<QWidget> > widgetsList =
87
88 QList<QPointer<QWidget> > filteredWidgets;
89 Q_FOREACH (QWidget* widget, widgetsList) {
90 if (widget->objectName() != "Stroke widget") {
91 filteredWidgets.push_back(widget);
92 }
93 }
94 return filteredWidgets;
95}
QList< QPointer< QWidget > > createOptionWidgets() override

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

◆ endPrimaryAction()

void KisToolPencil::endPrimaryAction ( KoPointerEvent * event)
override

Definition at line 78 of file kis_tool_pencil.cc.

79{
80 mouseReleaseEvent(event);
81}
void mouseReleaseEvent(KoPointerEvent *event) override

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

◆ mouseDoubleClickEvent()

void KisToolPencil::mouseDoubleClickEvent ( KoPointerEvent * event)
override

Definition at line 53 of file kis_tool_pencil.cc.

54{
55 Q_UNUSED(event)
56}

◆ mousePressEvent()

void KisToolPencil::mousePressEvent ( KoPointerEvent * event)
override

Definition at line 48 of file kis_tool_pencil.cc.

49{
50 Q_UNUSED(event);
51}

◆ resetCursorStyle

void KisToolPencil::resetCursorStyle ( )
overrideprotectedslot

Definition at line 29 of file kis_tool_pencil.cc.

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

References KisCursor::eraserCursor().

◆ updatePencilCursor()

void KisToolPencil::updatePencilCursor ( bool value)
private

Definition at line 40 of file kis_tool_pencil.cc.

41{
42 if (mode() == HOVER_MODE || mode() == PAINT_MODE) {
43 setCursor(value ? Qt::ArrowCursor : Qt::ForbiddenCursor);
45 }
46}
float value(const T *src, size_t ch)

References resetCursorStyle(), and value().

Friends And Related Symbol Documentation

◆ __KisToolPencilLocalTool

friend class __KisToolPencilLocalTool
friend

Definition at line 67 of file kis_tool_pencil.h.


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