1 | // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #include "qaxissetting.h" |
5 | #include "qaxissetting_p.h" |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | namespace Qt3DInput { |
10 | /*! |
11 | \class Qt3DInput::QAxisSetting |
12 | \inmodule Qt3DInput |
13 | \inherits Qt3DCore::QNode |
14 | \brief QAxisSetting stores settings for the specified list of Axis. |
15 | |
16 | Stores the dead zone associated with this axis and defines if smoothing is enabled |
17 | \since 5.5 |
18 | */ |
19 | |
20 | /*! |
21 | |
22 | \qmltype AxisSetting |
23 | \inqmlmodule Qt3D.Input |
24 | \instantiates Qt3DInput::QAxisSetting |
25 | \brief QML frontend for the Qt3DInput::QAxisSetting C++ class. |
26 | |
27 | Stores settings for the specified list of Axis |
28 | \since 5.5 |
29 | */ |
30 | |
31 | /*! |
32 | \qmlproperty list<int> AxisSetting::axes |
33 | */ |
34 | |
35 | |
36 | /*! |
37 | Constructs a new QAxisSetting instance with \a parent. |
38 | */ |
39 | QAxisSetting::QAxisSetting(Qt3DCore::QNode *parent) |
40 | : QNode(*new QAxisSettingPrivate(), parent) |
41 | { |
42 | } |
43 | |
44 | /*! \internal */ |
45 | QAxisSetting::~QAxisSetting() |
46 | { |
47 | } |
48 | |
49 | /*! |
50 | \property QAxisSetting::axes |
51 | */ |
52 | |
53 | /*! |
54 | * \brief QAxisSetting::axes |
55 | * \return the current list of Axis these settings apply to. |
56 | */ |
57 | QList<int> QAxisSetting::axes() const |
58 | { |
59 | Q_D(const QAxisSetting); |
60 | return d->m_axes; |
61 | } |
62 | |
63 | /*! |
64 | \property QAxisSetting::deadZoneRadius |
65 | */ |
66 | |
67 | /*! |
68 | * \brief QAxisSetting::deadZoneRadius |
69 | * \return the set dead zone radius. |
70 | */ |
71 | float QAxisSetting::deadZoneRadius() const |
72 | { |
73 | Q_D(const QAxisSetting); |
74 | return d->m_deadZoneRadius; |
75 | } |
76 | |
77 | /*! |
78 | \property QAxisSetting::smooth |
79 | */ |
80 | |
81 | /*! |
82 | * \brief QAxisSetting::isSmoothEnabled |
83 | * \return if smoothing is enabled. |
84 | */ |
85 | bool QAxisSetting::isSmoothEnabled() const |
86 | { |
87 | Q_D(const QAxisSetting); |
88 | return d->m_smooth; |
89 | } |
90 | |
91 | |
92 | /*! |
93 | \fn Qt3DInput::QAxisSetting::deadZoneRadiusChanged(float deadZoneRadius) |
94 | |
95 | This signal is emitted when the Dead Zone radius associated with the axis setting is changed to \a deadZoneRadius. |
96 | */ |
97 | |
98 | /*! |
99 | \qmlproperty float Qt3D.Input::AxisSetting::deadZoneRadius |
100 | |
101 | The current deadZone radius of the AxisSetting |
102 | */ |
103 | |
104 | /*! |
105 | \qmlsignal Qt3D.Input::AxisSetting::deadZoneRadiusChanged() |
106 | |
107 | This signal is emitted when the dead zone associated with the axis setting is changed. |
108 | |
109 | The corresponding handler is \c onDeadZoneRadiusChanged |
110 | */ |
111 | |
112 | /*! |
113 | Set the current dead zone radius of the QAxisSetting instance to \a deadZoneRadius. |
114 | */ |
115 | void QAxisSetting::setDeadZoneRadius(float deadZoneRadius) |
116 | { |
117 | Q_D(QAxisSetting); |
118 | if (d->m_deadZoneRadius == deadZoneRadius) |
119 | return; |
120 | |
121 | d->m_deadZoneRadius = deadZoneRadius; |
122 | emit deadZoneRadiusChanged(deadZoneRadius); |
123 | } |
124 | |
125 | /*! |
126 | \fn Qt3DInput::QAxisSetting::axesChanged(const QList<int> &axes) |
127 | |
128 | This signal is emitted when the axes associated with the axis setting is changed to \a axes. |
129 | */ |
130 | |
131 | /*! |
132 | \qmlproperty QVariantList Qt3D.Input::AxisSetting::axis |
133 | |
134 | The current axis of the AxisSetting |
135 | */ |
136 | |
137 | /*! |
138 | \qmlsignal Qt3D.Input::AxisSetting::axisChanged() |
139 | |
140 | This signal is emitted when the axis associated with the axis setting is changed. |
141 | |
142 | The corresponding handler is \c onAxisChanged |
143 | */ |
144 | |
145 | /*! |
146 | Set the current axes of the QAxisSetting instance to \a axes. |
147 | */ |
148 | void QAxisSetting::setAxes(const QList<int> &axes) |
149 | { |
150 | Q_D(QAxisSetting); |
151 | if (d->m_axes == axes) |
152 | return; |
153 | |
154 | d->m_axes = axes; |
155 | emit axesChanged(axes); |
156 | } |
157 | |
158 | /*! |
159 | \fn Qt3DInput::QAxisSetting::smoothChanged(bool smooth) |
160 | |
161 | This signal is emitted when the smoothing state is changed to \a smooth. |
162 | */ |
163 | |
164 | /*! |
165 | \qmlproperty bool Qt3D.Input::AxisSetting::smooth |
166 | |
167 | The current state of smoothing |
168 | */ |
169 | |
170 | /*! |
171 | \qmlsignal Qt3D.Input::AxisSetting::smoothChanged() |
172 | |
173 | This signal is emitted when the when the smoothing state is changed. |
174 | |
175 | The corresponding handler is \c onSmoothChanged |
176 | */ |
177 | |
178 | /*! |
179 | Set the current state of the QAxisSettings smoothing to \a enabled. |
180 | */ |
181 | void QAxisSetting::setSmoothEnabled(bool enabled) |
182 | { |
183 | Q_D(QAxisSetting); |
184 | if (d->m_smooth == enabled) |
185 | return; |
186 | |
187 | d->m_smooth = enabled; |
188 | emit smoothChanged(smooth: enabled); |
189 | } |
190 | |
191 | } // namespace Qt3DInput |
192 | |
193 | QT_END_NAMESPACE |
194 | |
195 | #include "moc_qaxissetting.cpp" |
196 | |