QSkinny
0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskGesture.h
1
/******************************************************************************
2
* QSkinny - Copyright (C) The authors
3
* SPDX-License-Identifier: BSD-3-Clause
4
*****************************************************************************/
5
6
#ifndef QSK_GESTURE_H
7
#define QSK_GESTURE_H
8
9
#include "QskGlobal.h"
10
11
#include <qmetatype.h>
12
#include <qpoint.h>
13
14
class
QSK_EXPORT
QskGesture
15
{
16
Q_GADGET
17
18
public
:
19
enum
Type
20
{
21
NoType = -1,
22
23
Tap,
24
TapAndHold,
25
Pan,
26
#if 0
27
// TODO
28
Pinch,
29
#endif
30
Swipe,
31
32
CustomType = 16
33
};
34
Q_ENUM( Type )
35
36
enum
State
37
{
38
NoGesture,
39
40
Started,
41
Updated,
42
Finished,
43
Canceled
44
};
45
Q_ENUM( State )
46
47
virtual
~QskGesture
();
48
49
Type type()
const
{
return
m_type; }
50
51
void
setState( State );
52
inline
State state()
const
{
return
m_state; }
53
54
protected
:
55
Q_DISABLE_COPY(
QskGesture
)
56
57
QskGesture
( Type type );
58
59
const
Type m_type;
60
State m_state;
61
};
62
63
class
QSK_EXPORT
QskTapGesture
:
public
QskGesture
64
{
65
using
Inherited
=
QskGesture
;
66
67
public
:
68
QskTapGesture
();
69
~QskTapGesture
()
override
;
70
71
void
setPosition(
const
QPointF& pos );
72
inline
QPointF position()
const
{
return
m_position; }
73
74
private
:
75
QPointF m_position;
76
};
77
78
class
QSK_EXPORT
QskTapAndHoldGesture
:
public
QskGesture
79
{
80
using
Inherited
=
QskGesture
;
81
82
public
:
83
QskTapAndHoldGesture
();
84
~QskTapAndHoldGesture
()
override
;
85
86
void
setPosition(
const
QPointF& pos );
87
inline
QPointF position()
const
{
return
m_position; }
88
89
void
setTimeout(
int
msecs );
90
inline
int
timeout()
const
{
return
m_timeout; }
91
92
private
:
93
QPointF m_position;
94
int
m_timeout;
95
};
96
97
class
QSK_EXPORT
QskPanGesture
:
public
QskGesture
98
{
99
using
Inherited
=
QskGesture
;
100
101
public
:
102
QskPanGesture
();
103
~QskPanGesture
()
override
;
104
105
void
setVelocity( qreal );
106
inline
qreal velocity()
const
{
return
m_velocity; }
107
108
void
setOrigin(
const
QPointF& );
109
inline
const
QPointF& origin()
const
{
return
m_origin; }
110
111
void
setLastPosition(
const
QPointF& );
112
inline
QPointF lastPosition()
const
{
return
m_lastPosition; }
113
114
void
setPosition(
const
QPointF& );
115
inline
const
QPointF& position()
const
{
return
m_position; }
116
117
void
setAngle( qreal degrees );
118
inline
qreal angle()
const
{
return
m_angle; }
119
120
inline
QPointF delta()
const
{
return
m_position - m_lastPosition; }
121
122
private
:
123
qreal m_angle;
124
qreal m_velocity;
125
126
QPointF m_origin;
127
QPointF m_lastPosition;
128
QPointF m_position;
129
};
130
131
class
QSK_EXPORT
QskSwipeGesture
:
public
QskGesture
132
{
133
using
Inherited
=
QskGesture
;
134
135
public
:
136
QskSwipeGesture
();
137
~QskSwipeGesture
()
override
;
138
139
void
setAngle( qreal angle );
140
inline
qreal angle()
const
{
return
m_angle; };
141
142
private
:
143
qreal m_angle;
144
};
145
146
#endif
QskGesture
Definition
QskGesture.h:15
QskPanGesture
Definition
QskGesture.h:98
QskSwipeGesture
Definition
QskGesture.h:132
QskTapAndHoldGesture
Definition
QskGesture.h:79
QskTapGesture
Definition
QskGesture.h:64
src
controls
QskGesture.h
Generated by
1.9.8