Krita Source Code Documentation
Loading...
Searching...
No Matches
KisTouchHoldEventsPostponer.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KISTOUCHHOLDEVENTSPOSTPONER_H
8#define KISTOUCHHOLDEVENTSPOSTPONER_H
9
10#include <QTimer>
11#include <kritaui_export.h>
12
13class QTouchEvent;
14
47class KRITAUI_EXPORT KisTouchHoldEventsPostponer : public QObject
48{
49 Q_OBJECT
50public:
51 enum State {
54 HoldCancelled
55 };
56public:
62 KisTouchHoldEventsPostponer(qreal maxHoldDistance, int holdTimeout);
65
69 State state() const;
70
84 void pushThrough(QTouchEvent *event);
85
89 void cancelHoldWait();
90
96 QVector<QTouchEvent*> postponedEvents();
97
98Q_SIGNALS:
103
104private Q_SLOTS:
105 void slotHoldCompletionTimeout();
106
107private:
113 bool qualifyForPostponing(QTouchEvent *event);
114
119 void enqueueEvent(QTouchEvent *event);
120
121private:
122 QTimer m_timer;
123 State m_state { WaitingForHold };
125 qreal m_maxHoldDistance {20.0} ;
126};
127
128#endif // KISTOUCHHOLDEVENTSPOSTPONER_H
@ HoldCompleted
the postponer is still accumulating the events
QVector< QTouchEvent * > m_postponedEvents
KisTouchHoldEventsPostponer(const KisTouchHoldEventsPostponer &rhs)=delete