|
Krita Source Code Documentation
|
Tool Invocation action of KisAbstractInputAction. More...
#include <kis_tool_invocation_action.h>
Inheritance diagram for KisToolInvocationAction:Classes | |
| class | Private |
Public Member Functions | |
| void | activate (int shortcut) override |
| void | begin (int shortcut, QEvent *event) override |
| bool | canIgnoreModifiers () const override |
| void | deactivate (int shortcut) override |
| void | end (QEvent *event) override |
| KisInputActionGroup | inputActionGroup (int shortcut) const override |
| void | inputEvent (QEvent *event) override |
| bool | isShortcutRequired (int shortcut) const override |
| KisToolInvocationAction () | |
| int | priority () const override |
| void | processUnhandledEvent (QEvent *event) |
| bool | supportsHiResInputEvents (int shortcut) const override |
| ~KisToolInvocationAction () override | |
Public Member Functions inherited from KisAbstractInputAction | |
| virtual QString | description () const |
| virtual QString | id () const |
| virtual bool | isAvailable () const |
| KisAbstractInputAction (const QString &id) | |
| virtual QString | name () const |
| virtual QHash< QString, int > | shortcutIndexes () const |
| virtual | ~KisAbstractInputAction () |
Private Attributes | |
| Private *const | d |
Additional Inherited Members | |
Public Attributes inherited from KisAbstractInputAction | |
| QString | description |
| QString | id |
| QHash< QString, int > | indexes |
| QPointF | lastCursorPosition |
| QString | name |
| QPointF | startCursorPosition |
Static Public Attributes inherited from KisAbstractInputAction | |
| static KisInputManager * | inputManager |
Protected Member Functions inherited from KisAbstractInputAction | |
| virtual void | cursorMoved (const QPointF &lastPos, const QPointF &pos) |
| virtual void | cursorMovedAbsolute (const QPointF &startPos, const QPointF &pos) |
| QPoint | eventPos (const QEvent *event) |
| QPointF | eventPosF (const QEvent *event) |
| KisInputManager * | inputManager () const |
| void | setDescription (const QString &description) |
| void | setName (const QString &name) |
| void | setShortcutIndexes (const QHash< QString, int > &indexes) |
Tool Invocation action of KisAbstractInputAction.
The Tool Invocation action invokes the current tool, for example, using the brush tool, it will start painting.
Definition at line 18 of file kis_tool_invocation_action.h.
Definition at line 21 of file kis_tool_invocation_action.h.
|
explicit |
Definition at line 34 of file kis_tool_invocation_action.cpp.
References ActivateShortcut, ActivateWithOtherColorShortcut, CancelShortcut, ConfirmShortcut, ContigSelToolShortcut, EllipseSelToolShortcut, EllipseToolShortcut, FillToolShortcut, FreehandSelToolShortcut, GradientToolShortcut, KisAbstractInputAction::indexes, LineToolShortcut, MeasureToolShortcut, MoveToolShortcut, RectSelToolShortcut, RectToolShortcut, KisAbstractInputAction::setDescription(), KisAbstractInputAction::setName(), and KisAbstractInputAction::setShortcutIndexes().
|
override |
|
overridevirtual |
The method is called when the action is yet to be started, that is, e.g. the user has pressed all the modifiers for the action but hasn't started painting yet. This method is a right place to show the user what is going to happen, e.g. change the cursor.
Reimplemented from KisAbstractInputAction.
Definition at line 66 of file kis_tool_invocation_action.cpp.
References KisToolInvocationAction::Private::activatedToolProxy, ActivateWithOtherColorShortcut, KisInputManager::canvas(), ContigSelToolShortcut, d, EllipseSelToolShortcut, EllipseToolShortcut, FillToolShortcut, FreehandSelToolShortcut, GradientToolShortcut, KisAbstractInputAction::inputManager, KoToolManager::instance(), KisToolInvocationAction::Private::isUsingOtherColor, LineToolShortcut, MeasureToolShortcut, MoveToolShortcut, KisTool::Primary, RectSelToolShortcut, RectToolShortcut, KoCanvasBase::resourceManager, KoToolManager::switchToolRequested(), and KisInputManager::toolProxy().
|
overridevirtual |
Begin the action.
| shortcut | The index of the behaviour to trigger. |
| event | The mouse event that has triggered this action. Is null for keyboard-activated actions. |
All the tools now have a KisTool::requestStrokeEnd() method, so they should use this instead of direct filtering Enter key press. Until all the tools support it, we just duplicate the key event and the method call
Some tools would like to distinguish automated requestStrokeEnd() calls from explicit user actions. Just let them do it!
Please note that this call should happen after requestStrokeEnd(). Some of the tools will switch to another tool on this request, and this (next) tool does not expect to get requestStrokeEnd() right after switching in.
The tools now have a KisTool::requestStrokeCancellation() method, so just request it.
Reimplemented from KisAbstractInputAction.
Definition at line 160 of file kis_tool_invocation_action.cpp.
References KisToolInvocationAction::Private::active, KisToolProxy::BEGIN, CancelShortcut, KisInputManager::canvas(), ConfirmShortcut, d, KisCanvas2::image(), KisAbstractInputAction::inputManager, KisTool::Primary, KisImage::requestStrokeCancellation(), KisImage::requestStrokeEnd(), KisToolInvocationAction::Private::runningToolProxy, and KisInputManager::toolProxy().
|
overridevirtual |
Returns true if an action can run with any modifiers pressed (the shortcut's modifiers list must be empty for that). That is used for making one type of actions default one.
Reimplemented from KisAbstractInputAction.
Definition at line 155 of file kis_tool_invocation_action.cpp.
|
overridevirtual |
The method is called when the action is not a candidate for the starting anymore. The action should revert everything that was done in activate() method.
Activate call might have come before actual input manager or tool proxy was attached. So we may end up with null activatedToolProxy.
Reimplemented from KisAbstractInputAction.
Definition at line 123 of file kis_tool_invocation_action.cpp.
References KisToolInvocationAction::Private::activatedToolProxy, ActivateShortcut, ActivateWithOtherColorShortcut, CancelShortcut, KisInputManager::canvas(), ConfirmShortcut, d, KisToolInvocationAction::Private::deactivating, KisAbstractInputAction::inputManager, KoToolManager::instance(), KisToolInvocationAction::Private::isUsingOtherColor, KisTool::Primary, KoCanvasBase::resourceManager, and KoToolManager::switchBackRequested().
|
overridevirtual |
End the action.
| event | The mouse event that has finished this action. Is null for keyboard-activated actions. |
Reimplemented from KisAbstractInputAction.
Definition at line 203 of file kis_tool_invocation_action.cpp.
References KisToolInvocationAction::Private::active, d, KisToolProxy::END, KisAbstractInputAction::end(), KIS_SAFE_ASSERT_RECOVER_NOOP, KisTool::Primary, and KisToolInvocationAction::Private::runningToolProxy.
|
overridevirtual |
shortcut belongs to Reimplemented from KisAbstractInputAction.
Definition at line 255 of file kis_tool_invocation_action.cpp.
References ToolInvoactionActionGroup.
|
overridevirtual |
Process an input event.
By default handles MouseMove events and passes the data to a convenience cursorMoved() method
| event | An event to process. |
Reimplemented from KisAbstractInputAction.
Definition at line 220 of file kis_tool_invocation_action.cpp.
References KisToolInvocationAction::Private::active, KisToolProxy::CONTINUE, d, KisTool::Primary, and KisToolInvocationAction::Private::runningToolProxy.
|
overridevirtual |
Return true when the specified shortcut is required for basic user interaction. This is used by the configuration system to prevent basic actions like painting from being removed.
| shortcut | The shortcut index to check. |
Reimplemented from KisAbstractInputAction.
Definition at line 248 of file kis_tool_invocation_action.cpp.
References ActivateShortcut, CancelShortcut, and ConfirmShortcut.
|
overridevirtual |
The priority for this action.
Priority determines how "important" the action is and is used to resolve conflicts when multiple actions can be activated.
Reimplemented from KisAbstractInputAction.
Definition at line 150 of file kis_tool_invocation_action.cpp.
| void KisToolInvocationAction::processUnhandledEvent | ( | QEvent * | event | ) |
Definition at line 229 of file kis_tool_invocation_action.cpp.
References KisToolInvocationAction::Private::active, d, inputEvent(), KisAbstractInputAction::inputManager, KisToolInvocationAction::Private::runningToolProxy, and KisInputManager::toolProxy().
|
overridevirtual |
Returns true if the action can handle HiRes flow of move events which is generated by the tablet. If the function returns false, some of the events will be dropped or postponed. For most of the actions in Krita (except of real painting) it is perfectly acceptable, so 'false' is the default value.
Reimplemented from KisAbstractInputAction.
Definition at line 242 of file kis_tool_invocation_action.cpp.
References KisAbstractInputAction::inputManager, and KisInputManager::toolProxy().
|
private |
Definition at line 63 of file kis_tool_invocation_action.h.