|
Krita Source Code Documentation
|
#include <KisTouchHoldEventsPostponer.h>
Inheritance diagram for KisTouchHoldEventsPostponer:Public Types | |
| enum | State { WaitingForHold , HoldCompleted , HoldCancelled } |
Signals | |
| void | sigHoldCompleted () |
Public Member Functions | |
| void | cancelHoldWait () |
| KisTouchHoldEventsPostponer (const KisTouchHoldEventsPostponer &rhs)=delete | |
| KisTouchHoldEventsPostponer (qreal maxHoldDistance, int holdTimeout) | |
| QVector< QTouchEvent * > | postponedEvents () |
| void | pushThrough (QTouchEvent *event) |
| State | state () const |
| ~KisTouchHoldEventsPostponer () | |
Private Slots | |
| void | slotHoldCompletionTimeout () |
Private Member Functions | |
| void | enqueueEvent (QTouchEvent *event) |
| bool | qualifyForPostponing (QTouchEvent *event) |
Private Attributes | |
| qreal | m_maxHoldDistance {20.0} |
| QVector< QTouchEvent * > | m_postponedEvents |
| State | m_state { WaitingForHold } |
| QTimer | m_timer |
The object to store and manage postponed events while waiting for a touch-hold shortcut to trigger. Currently, it supports single- finger touch actions only.
Usage:
Definition at line 47 of file KisTouchHoldEventsPostponer.h.
Definition at line 51 of file KisTouchHoldEventsPostponer.h.
| KisTouchHoldEventsPostponer::KisTouchHoldEventsPostponer | ( | qreal | maxHoldDistance, |
| int | holdTimeout ) |
Createa touch-hold postponer with maxHoldDistance used as a threshold for hold/drag and holdTimeout as a timeout to consider the hold operation completed
Definition at line 25 of file KisTouchHoldEventsPostponer.cpp.
References m_timer, and slotHoldCompletionTimeout().
|
delete |
| KisTouchHoldEventsPostponer::~KisTouchHoldEventsPostponer | ( | ) |
Definition at line 43 of file KisTouchHoldEventsPostponer.cpp.
References m_postponedEvents.
| void KisTouchHoldEventsPostponer::cancelHoldWait | ( | ) |
Cancel waiting for a touch hold. The state will transition into HoldCancelled
Definition at line 67 of file KisTouchHoldEventsPostponer.cpp.
References HoldCancelled, m_state, and m_timer.
|
private |
Make a clone of the event and add to the queue. Can be removed after we stop supporting Qt5.
Definition at line 107 of file KisTouchHoldEventsPostponer.cpp.
References m_postponedEvents.
| QVector< QTouchEvent * > KisTouchHoldEventsPostponer::postponedEvents | ( | ) |
Definition at line 73 of file KisTouchHoldEventsPostponer.cpp.
References KIS_SAFE_ASSERT_RECOVER_NOOP, m_postponedEvents, m_state, and WaitingForHold.
| void KisTouchHoldEventsPostponer::pushThrough | ( | QTouchEvent * | event | ) |
Push a new event through the postponer. The method should be called in WaitingForHold state only. In all other states the postponer is not considered as active anymore.
If event does not qualify as an event for touch-hold, then the state of the postponer will be switched into HoldCancelled, which should be handled by the called on exiting pushThrough().
Note: the event that caused the state transition into HoldCancelled state will still be added to the queue, so that it could be managed uniformely with the rest of the postponed events.
Definition at line 53 of file KisTouchHoldEventsPostponer.cpp.
References cancelHoldWait(), enqueueEvent(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_state, qualifyForPostponing(), and WaitingForHold.
|
private |
event can be considered as a touch-hold eventIt is currently hardcoded to support only single-finger touch-holds.
Definition at line 94 of file KisTouchHoldEventsPostponer.cpp.
References KisTouchShortcut::countTouchPoints(), m_maxHoldDistance, KisTouchShortcut::pressedOnlyTouchStates(), and KisTouchShortcut::touchDragDistance().
|
signal |
Emitted when the postponed has detected a touch-and-hold action
|
privateslot |
Definition at line 79 of file KisTouchHoldEventsPostponer.cpp.
References HoldCompleted, KIS_SAFE_ASSERT_RECOVER_NOOP, m_postponedEvents, m_state, sigHoldCompleted(), and WaitingForHold.
| KisTouchHoldEventsPostponer::State KisTouchHoldEventsPostponer::state | ( | ) | const |
Definition at line 48 of file KisTouchHoldEventsPostponer.cpp.
References m_state.
|
private |
Definition at line 125 of file KisTouchHoldEventsPostponer.h.
|
private |
Definition at line 124 of file KisTouchHoldEventsPostponer.h.
|
private |
Definition at line 123 of file KisTouchHoldEventsPostponer.h.
|
private |
Definition at line 122 of file KisTouchHoldEventsPostponer.h.