|
Krita Source Code Documentation
|
#include <kis_stroke_shortcut.h>
Inheritance diagram for KisStrokeShortcut:Public Member Functions | |
| QMouseEvent | fakeEndEvent (const QPointF &localPos) const |
| KisStrokeShortcut (KisAbstractInputAction *action, int index) | |
| bool | matchBegin (Qt::MouseButton button) |
| bool | matchReady (const QSet< Qt::Key > &modifiers, const QSet< Qt::MouseButton > &buttons) |
| int | priority () const override |
| void | setButtons (const QSet< Qt::Key > &modifiers, const QSet< Qt::MouseButton > &buttons) |
| ~KisStrokeShortcut () override | |
Public Member Functions inherited from KisAbstractShortcut | |
| KisAbstractInputAction * | action () const |
| bool | isAvailable (KisInputActionGroupsMask mask) const |
| KisAbstractShortcut (KisAbstractInputAction *action, int index) | |
| void | setAction (KisAbstractInputAction *action) |
| int | shortcutIndex () const |
| virtual | ~KisAbstractShortcut () |
Public Attributes | |
| QSet< Qt::MouseButton > | buttons |
| QSet< Qt::Key > | modifiers |
Public Attributes inherited from KisAbstractShortcut | |
| KisAbstractInputAction * | action |
| int | shortcutIndex |
Private Attributes | |
| Private *const | m_d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Additional Inherited Members | |
Protected Member Functions inherited from KisAbstractShortcut | |
| bool | compareKeys (const QSet< Qt::Key > &keys1, const QSet< Qt::Key > &keys2) |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
This class represents a shortcut that starts an action that can involve pressing the mouse button and, probably, moving the cursor.
The stroke shortcut may be represented as a simple state machine: It transits between 3 states:
Idle <-> Ready <-> Running
The possibility of transition between Idle <-> Ready is defined with a matchReady() method. The transition Ready <-> Running is defined by matchBegin(). The Ready state is used for showing the user the cursor of the upcoming action and the Running state shows that the action linked to the shortcut should be activated.
Definition at line 15 of file kis_stroke_shortcut.cpp.
| KisStrokeShortcut::KisStrokeShortcut | ( | KisAbstractInputAction * | action, |
| int | index ) |
Definition at line 23 of file kis_stroke_shortcut.cpp.
|
override |
| QMouseEvent KisStrokeShortcut::fakeEndEvent | ( | const QPointF & | localPos | ) | const |
Definition at line 76 of file kis_stroke_shortcut.cpp.
| bool KisStrokeShortcut::matchBegin | ( | Qt::MouseButton | button | ) |
| bool KisStrokeShortcut::matchReady | ( | const QSet< Qt::Key > & | modifiers, |
| const QSet< Qt::MouseButton > & | buttons ) |
Reports whether all but one buttons and modifiers are pressed for the shortcut. Such configuration means that the input manager can show the user that pressing the mouse button will start some action. This can be done with, e.g. changing the cursor.
Definition at line 54 of file kis_stroke_shortcut.cpp.
References KisAbstractShortcut::action, button(), buttons, KisAbstractInputAction::canIgnoreModifiers(), KisAbstractShortcut::compareKeys(), m_d, and modifiers.
|
overridevirtual |
The priority of the shortcut. The shortcut with the greatest value will be chosen for execution
Implements KisAbstractShortcut.
Definition at line 34 of file kis_stroke_shortcut.cpp.
References KisAbstractShortcut::action, button(), m_d, and KisAbstractInputAction::priority().
| void KisStrokeShortcut::setButtons | ( | const QSet< Qt::Key > & | modifiers, |
| const QSet< Qt::MouseButton > & | buttons ) |
Sets the configuration for this shortcut
| modifiers | keyboard keys that should be held for the shortcut to trigger |
| buttons | mouse buttons that should be pressed (simultaneously) for the shortcut to trigger |
Definition at line 45 of file kis_stroke_shortcut.cpp.
| QSet<Qt::MouseButton> KisStrokeShortcut::buttons |
Definition at line 19 of file kis_stroke_shortcut.cpp.
|
private |
Definition at line 69 of file kis_stroke_shortcut.h.
| QSet<Qt::Key> KisStrokeShortcut::modifiers |
Definition at line 18 of file kis_stroke_shortcut.cpp.