|
Krita Source Code Documentation
|
Abstract base class for input actions. More...
#include <kis_abstract_input_action.h>
Inheritance diagram for KisAbstractInputAction:Public Member Functions | |
| virtual void | activate (int shortcut) |
| virtual void | begin (int shortcut, QEvent *event) |
| virtual bool | canIgnoreModifiers () const |
| virtual void | deactivate (int shortcut) |
| virtual QString | description () const |
| virtual void | end (QEvent *event) |
| virtual QString | id () const |
| virtual KisInputActionGroup | inputActionGroup (int shortcut) const |
| virtual void | inputEvent (QEvent *event) |
| virtual bool | isAvailable () const |
| virtual bool | isShortcutRequired (int shortcut) const |
| KisAbstractInputAction (const QString &id) | |
| virtual QString | name () const |
| virtual int | priority () const |
| virtual QHash< QString, int > | shortcutIndexes () const |
| virtual bool | supportsHiResInputEvents (int shortcut) const |
| virtual | ~KisAbstractInputAction () |
Public Attributes | |
| QString | description |
| QString | id |
| QHash< QString, int > | indexes |
| QPointF | lastCursorPosition |
| QString | name |
| QPointF | startCursorPosition |
Static Public Attributes | |
| static KisInputManager * | inputManager |
Protected Member Functions | |
| 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) |
Static Private Member Functions | |
| static void | setInputManager (KisInputManager *manager) |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Friends | |
| class | KisInputManager |
Additional Inherited Members | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Abstract base class for input actions.
Input actions represent actions to be performed when interacting with the canvas. They are managed by KisInputManager and activated when KisKeyShortcut or KisStrokeShortcut detects it matches a certain set of inputs.
The begin() method uses an index for the type of behaviour to activate. This index can be used to trigger behaviour when different events occur.
The events can be of two types: 1) Key events. The input manager calls begin() and end() sequentially with an index parameter to begin() representing the type of action that should be performed. The event parameter of both calls in null. 2) Stroke events. The input manager calls begin() and end() on the corresponding mouse down and up events. The event parameter will be of QMouseEvent type, representing the event happened. All the mouse move events between begin() and end() will be redirected to the inputEvent() method.
Definition at line 18 of file kis_abstract_input_action.cpp.
|
explicit |
Constructor.
| manager | The InputManager this action belongs to. |
Definition at line 34 of file kis_abstract_input_action.cpp.
|
virtual |
|
virtual |
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 in KisAlternateInvocationAction, KisChangePrimarySettingAction, KisGammaExposureAction, KisPanAction, KisRotateCanvasAction, KisSelectLayerAction, KisToolInvocationAction, KisZoomAction, and KisZoomAndRotateAction.
Definition at line 46 of file kis_abstract_input_action.cpp.
|
virtual |
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. |
Reimplemented in KisAlternateInvocationAction, KisChangeFrameAction, KisChangePrimarySettingAction, KisPanAction, KisRotateCanvasAction, KisSelectLayerAction, KisToolInvocationAction, KisZoomAndRotateAction, KisTouchGestureAction, KisZoomAction, KisCanvasOnlyAction, and KisGammaExposureAction.
Definition at line 56 of file kis_abstract_input_action.cpp.
References d, and eventPosF().
|
virtual |
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 in KisToolInvocationAction.
Definition at line 125 of file kis_abstract_input_action.cpp.
|
protectedvirtual |
Convenience method for handling cursor movement for tablet, mouse and touch. The default implementation of inputEvent calls this function.
Definition at line 81 of file kis_abstract_input_action.cpp.
|
protectedvirtual |
Reimplemented in KisGammaExposureAction, KisPanAction, KisZoomAndRotateAction, KisRotateCanvasAction, and KisZoomAction.
Definition at line 87 of file kis_abstract_input_action.cpp.
|
virtual |
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.
Reimplemented in KisAlternateInvocationAction, KisChangePrimarySettingAction, KisGammaExposureAction, KisPanAction, KisRotateCanvasAction, KisSelectLayerAction, KisToolInvocationAction, KisZoomAction, and KisZoomAndRotateAction.
Definition at line 51 of file kis_abstract_input_action.cpp.
|
virtual |
A short description of this action.
|
virtual |
End the action.
| event | The mouse event that has finished this action. Is null for keyboard-activated actions. |
Reimplemented in KisPopupWidgetAction, KisAlternateInvocationAction, KisChangePrimarySettingAction, KisPanAction, KisRotateCanvasAction, KisToolInvocationAction, and KisTouchGestureAction.
Definition at line 76 of file kis_abstract_input_action.cpp.
|
protected |
Convenience method to extract the position from a cursor movement event.
| event | A mouse or tablet event. |
Native gesture event has an issue in Qt on MacOS, its event->position() method returns an incorrect value (not in the widget's coordinates). So we should manually map it from global.
Definition at line 166 of file kis_abstract_input_action.cpp.
References Private::canvas, KisCanvas2::canvasWidget, d, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, and warnInput.
|
protected |
Convenience method to extract the floating point position from a cursor movement event.
| event | A mouse or tablet event. |
Native gesture event has an issue in Qt on MacOS, its event->position() method returns an incorrect value (not in the widget's coordinates). So we should manually map it from global.
Definition at line 215 of file kis_abstract_input_action.cpp.
References Private::canvas, KisCanvas2::canvasWidget, d, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, and warnInput.
|
virtual |
The id of this action.
|
virtual |
shortcut belongs to Reimplemented in KisPanAction, KisRotateCanvasAction, KisToolInvocationAction, KisZoomAction, and KisZoomAndRotateAction.
Definition at line 99 of file kis_abstract_input_action.cpp.
References ModifyingActionGroup.
|
virtual |
Process an input event.
By default handles MouseMove events and passes the data to a convenience cursorMoved() method
| event | An event to process. |
Reimplemented in KisAlternateInvocationAction, KisChangePrimarySettingAction, KisPanAction, KisRotateCanvasAction, KisSelectLayerAction, KisToolInvocationAction, KisZoomAction, and KisZoomAndRotateAction.
Definition at line 66 of file kis_abstract_input_action.cpp.
References cursorMoved(), cursorMovedAbsolute(), d, and eventPosF().
|
protected |
The input manager this action belongs to.
|
virtual |
Some of the actions are available in particular situations only. E.g. switch frame action is available iff an animated layer is selected. If isAvailable() returns true then the action will not be triggered by the shortcut matcher.
Reimplemented in KisChangeFrameAction.
Definition at line 259 of file kis_abstract_input_action.cpp.
|
virtual |
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 in KisGammaExposureAction, KisPanAction, KisToolInvocationAction, and KisZoomAction.
Definition at line 160 of file kis_abstract_input_action.cpp.
|
virtual |
The translated name of this action.
|
virtual |
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 in KisAlternateInvocationAction, KisChangePrimarySettingAction, KisGammaExposureAction, KisPanAction, KisRotateCanvasAction, KisSelectLayerAction, KisToolInvocationAction, KisZoomAction, KisZoomAndRotateAction, KisCanvasOnlyAction, KisPopupWidgetAction, and KisTouchGestureAction.
Definition at line 120 of file kis_abstract_input_action.cpp.
|
protected |
Set the description of this action.
| description | The new description. |
Definition at line 145 of file kis_abstract_input_action.cpp.
References d, and description.
|
staticprivate |
Definition at line 155 of file kis_abstract_input_action.cpp.
|
protected |
Set the name of this action.
| name | The new name. |
Definition at line 140 of file kis_abstract_input_action.cpp.
|
protected |
Set the available indexes of shortcut behaviours.
| indexes | The new indexes. |
Definition at line 150 of file kis_abstract_input_action.cpp.
|
virtual |
The indexes of shortcut behaviours available.
Definition at line 130 of file kis_abstract_input_action.cpp.
References d.
|
virtual |
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 in KisAlternateInvocationAction, KisChangePrimarySettingAction, KisPanAction, KisRotateCanvasAction, KisToolInvocationAction, and KisZoomAction.
Definition at line 93 of file kis_abstract_input_action.cpp.
|
friend |
Definition at line 213 of file kis_abstract_input_action.h.
|
private |
Definition at line 217 of file kis_abstract_input_action.h.
| QString KisAbstractInputAction::description |
Definition at line 23 of file kis_abstract_input_action.cpp.
| QString KisAbstractInputAction::id |
Definition at line 21 of file kis_abstract_input_action.cpp.
| QHash<QString, int> KisAbstractInputAction::indexes |
Definition at line 24 of file kis_abstract_input_action.cpp.
|
static |
Definition at line 29 of file kis_abstract_input_action.cpp.
| QPointF KisAbstractInputAction::lastCursorPosition |
Definition at line 26 of file kis_abstract_input_action.cpp.
| QString KisAbstractInputAction::name |
Definition at line 22 of file kis_abstract_input_action.cpp.
| QPointF KisAbstractInputAction::startCursorPosition |
Definition at line 27 of file kis_abstract_input_action.cpp.