Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtuiocursor_p.h
Go to the documentation of this file.
1// Copyright (C) 2014 Robin Burchell <robin.burchell@viroteck.net>
2// Copyright (C) 2016 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QTUIOCURSOR_P_H
6#define QTUIOCURSOR_P_H
7
8#include <Qt>
9
11
13{
14public:
15 QTuioCursor(int id = -1)
16 : m_id(id)
17 , m_x(0)
18 , m_y(0)
19 , m_vx(0)
20 , m_vy(0)
21 , m_acceleration(0)
22 , m_state(QEventPoint::State::Pressed)
23 {
24 }
25
26 int id() const { return m_id; }
27
28 void setX(float x)
29 {
31 !qFuzzyCompare(m_x + 2.0, x + 2.0)) { // +2 because 1 is a valid value, and qFuzzyCompare can't cope with 0.0
33 }
34 m_x = x;
35 }
36 float x() const { return m_x; }
37
38 void setY(float y)
39 {
41 !qFuzzyCompare(m_y + 2.0, y + 2.0)) { // +2 because 1 is a valid value, and qFuzzyCompare can't cope with 0.0
43 }
44 m_y = y;
45 }
46 float y() const { return m_y; }
47
48 void setVX(float vx) { m_vx = vx; }
49 float vx() const { return m_vx; }
50
51 void setVY(float vy) { m_vy = vy; }
52 float vy() const { return m_vy; }
53
54 void setAcceleration(float acceleration) { m_acceleration = acceleration; }
55 float acceleration() const { return m_acceleration; }
56
57 void setState(const QEventPoint::State &state) { m_state = state; }
58 QEventPoint::State state() const { return m_state; }
59
60private:
61 int m_id;
62 float m_x;
63 float m_y;
64 float m_vx;
65 float m_vy;
66 float m_acceleration;
67 QEventPoint::State m_state;
68};
69Q_DECLARE_TYPEINFO(QTuioCursor, Q_RELOCATABLE_TYPE); // Q_PRIMITIVE_TYPE: not possible, m_state is = 1, not 0.
70
72
73#endif // QTUIOCURSOR_P_H
The QEventPoint class provides information about a point in a QPointerEvent.
Definition qeventpoint.h:20
State
Specifies the state of this event point.
Definition qeventpoint.h:48
void setX(float x)
void setVY(float vy)
float acceleration() const
void setVX(float vx)
float vx() const
void setAcceleration(float acceleration)
QEventPoint::State state() const
void setState(const QEventPoint::State &state)
float vy() const
int id() const
float x() const
void setY(float y)
float y() const
QTuioCursor(int id=-1)
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint id
[7]
GLint y
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180