|
Krita Source Code Documentation
|
#include <KoInteractionTool.h>
Inheritance diagram for KoInteractionTool:Public Member Functions | |
| void | keyPressEvent (QKeyEvent *event) override |
| void | keyReleaseEvent (QKeyEvent *event) override |
| KoInteractionTool (KoCanvasBase *canvas) | |
| void | mouseMoveEvent (KoPointerEvent *event) override |
| void | mousePressEvent (KoPointerEvent *event) override |
| void | mouseReleaseEvent (KoPointerEvent *event) override |
| void | paint (QPainter &painter, const KoViewConverter &converter) override |
| ~KoInteractionTool () override | |
Public Member Functions inherited from KoToolBase | |
| QAction * | action (const QString &name) const |
| KoCanvasBase * | canvas () const |
| Returns the canvas the tool is working on. | |
| virtual void | copy () const |
| QCursor | cursor () const |
| return the last emitted cursor | |
| virtual void | customMoveEvent (KoPointerEvent *event) |
| virtual void | customPressEvent (KoPointerEvent *event) |
| virtual void | customReleaseEvent (KoPointerEvent *event) |
| virtual void | cut () |
| virtual QRectF | decorationsRect () const |
| int | decorationThickness () const |
| decorationThickness The minimum thickness for tool decoration lines, this is derived from the screen magnification, thus the HiDPI settings. Note: to use this effectively, also set the pen to isCosmetic(true); | |
| virtual void | deleteSelection () |
| virtual void | deselect () |
| deselect the tool should clear the selection if it has one. | |
| virtual void | dragLeaveEvent (QDragLeaveEvent *event) |
| virtual void | dragMoveEvent (QDragMoveEvent *event, const QPointF &point) |
| virtual void | dropEvent (QDropEvent *event, const QPointF &point) |
| virtual void | explicitUserStrokeEndRequest () |
| explicitUserStrokeEndRequest is called by the input manager when the user presses Enter key or any equivalent. This callback comes before requestStrokeEnd(), which comes from a different source. | |
| KoToolFactoryBase * | factory () const |
| virtual void | focusInEvent (QFocusEvent *event) |
| virtual void | focusOutEvent (QFocusEvent *event) |
| virtual bool | hasSelection () |
| virtual void | inputMethodEvent (QInputMethodEvent *event) |
| virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const |
| bool | isInTextMode () const |
| bool | isOpacityPresetMode () const |
| KoToolBase (KoCanvasBase *canvas) | |
| bool | maskSyntheticEvents () const |
| virtual void | mouseDoubleClickEvent (KoPointerEvent *event) |
| virtual void | mouseTripleClickEvent (KoPointerEvent *event) |
| QList< QPointer< QWidget > > | optionWidgets () |
| virtual bool | paste () |
| virtual QMenu * | popupActionsMenu () |
| virtual KisPopupWidgetInterface * | popupWidget () |
| virtual bool | selectAll () |
| selectAll select all data the tool can select. | |
| virtual KoToolSelection * | selection () |
| Q_INVOKABLE QString | toolId () const |
| virtual bool | wantsAutoScroll () const |
| ~KoToolBase () override | |
Private Member Functions | |
| KoInteractionTool (const KoInteractionTool &) | |
| KoInteractionTool & | operator= (const KoInteractionTool &) |
Additional Inherited Members | |
Public Slots inherited from KoToolBase | |
| virtual void | activate (const QSet< KoShape * > &shapes) |
| virtual void | canvasResourceChanged (int key, const QVariant &res) |
| virtual void | deactivate () |
| virtual void | documentResourceChanged (int key, const QVariant &res) |
| virtual void | repaintDecorations () |
| virtual void | requestRedoDuringStroke () |
| virtual void | requestStrokeCancellation () |
| virtual void | requestStrokeEnd () |
| virtual void | requestUndoDuringStroke () |
| void | setStatusText (const QString &statusText) |
| void | updateOptionsWidgetIcons () |
Signals inherited from KoToolBase | |
| void | activateTool (const QString &id) |
| void | cursorChanged (const QCursor &cursor) |
| void | selectionChanged (bool hasSelection) |
| void | statusTextChanged (const QString &statusText) |
| void | textModeChanged (bool inTextMode) |
Protected Attributes inherited from KoToolBase | |
| KoToolBasePrivate * | d_ptr |
The interaction tool adds to the normal KoToolBase class the concept of strategies as a means to get one tool to have different actions the user can perform using the mouse. Each time the user presses the mouse until she releases the mouse a strategy object will be created, used and discarded. If the usage of a tool fits this pattern you need to inherit from this class instead of the plain KoToolBase and reimplement your createStrategy() method which returns a tool-specific strategy where all the real interaction code is placed. A tool can then become as simple as this;
Whereas your strategy (MyStrategy in the example) will contain the interaction code.
Definition at line 43 of file KoInteractionTool.h.
|
explicit |
Constructor for basic interaction tool where user actions are translated and handled by interaction strategies of type KoInteractionStrategy.
| canvas | the canvas this tool will be working for. |
Definition at line 20 of file KoInteractionTool.cpp.
|
override |
Definition at line 25 of file KoInteractionTool.cpp.
|
protected |
Definition at line 204 of file KoInteractionTool.cpp.
|
private |
|
protected |
Definition at line 149 of file KoInteractionTool.cpp.
References KoInteractionStrategyFactory::compareLess(), KoToolBase::factory(), KoToolFactoryBase::id, KIS_SAFE_ASSERT_RECOVER_RETURN, and toQShared().
|
protected |
Cancels the current strategy and deletes it.
Definition at line 125 of file KoInteractionTool.cpp.
|
protectedpure virtual |
Implemented in KoZoomTool, and DefaultTool.
|
protected |
Reimplement this factory method to create your strategy to be used for mouse interaction.
Definition at line 135 of file KoInteractionTool.cpp.
References createStrategy(), and KoToolBase::factory().
|
protected |
the strategy that is 'in progress'
Definition at line 119 of file KoInteractionTool.cpp.
|
protected |
Definition at line 178 of file KoInteractionTool.cpp.
|
overridevirtual |
Called when a key is pressed. Implementors should call event->ignore() if they do not actually use the event. Default implementation ignores this event.
| event | state and reason of this key press |
Reimplemented from KoToolBase.
Reimplemented in KoZoomTool.
Definition at line 87 of file KoInteractionTool.cpp.
|
overridevirtual |
Called when a key is released Implementors should call event->ignore() if they do not actually use the event. Default implementation ignores this event.
| event | state and reason of this key release |
Reimplemented from KoToolBase.
Reimplemented in KoZoomTool.
Definition at line 100 of file KoInteractionTool.cpp.
References cancelCurrentStrategy(), and KoToolBase::keyReleaseEvent().
|
overridevirtual |
Called when the mouse or stylus moved over the canvas. Implementors should call event->ignore() if they do not actually use the event.
| event | state and reason of this mouse or stylus move |
Implements KoToolBase.
Reimplemented in KoZoomTool.
Definition at line 55 of file KoInteractionTool.cpp.
References KoToolBase::factory(), and KoPointerEvent::modifiers().
|
overridevirtual |
Called when (one of) the mouse or stylus buttons is pressed. Implementors should call event->ignore() if they do not actually use the event.
| event | state and reason of this mouse or stylus press |
Implements KoToolBase.
Definition at line 43 of file KoInteractionTool.cpp.
References cancelCurrentStrategy(), and createStrategyBase().
|
overridevirtual |
Called when (one of) the mouse or stylus buttons is released. Implementors should call event->ignore() if they do not actually use the event.
| event | state and reason of this mouse or stylus release |
Implements KoToolBase.
Reimplemented in KoZoomTool.
Definition at line 72 of file KoInteractionTool.cpp.
References KoPointerEvent::modifiers(), and KoToolBase::repaintDecorations().
|
private |
|
overridevirtual |
Called by the canvas to paint any decorations that the tool deems needed. The painter has the top left of the canvas as its origin.
| painter | used for painting the shape |
| converter | to convert between internal and view coordinates. |
Implements KoToolBase.
Definition at line 29 of file KoInteractionTool.cpp.
References KoToolBase::factory().
|
protected |
Definition at line 163 of file KoInteractionTool.cpp.
|
protected |
Definition at line 191 of file KoInteractionTool.cpp.