Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dxrabstracthapticeffect.cpp
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
5
7
8/*!
9 \qmltype XrHapticEffect
10 \qmlabstract
11 \inherits QtObject
12 \inqmlmodule QtQuick3D.Xr
13 \brief Represents a haptic effect.
14 \since 6.9
15
16 XrHapticEffect defines the characteristics of the haptic effect.
17
18 This type is abstract. Use a subtype, such as \l XrSimpleHapticEffect.
19
20 \sa XrHapticFeedback XrSimpleHapticEffect
21 */
22
23/*!
24 \qmltype XrSimpleHapticEffect
25 \inherits XrHapticEffect
26 \inqmlmodule QtQuick3D.Xr
27 \brief Allows setting controller haptics using amplitude, duration and frequency.
28 \since 6.9
29
30 \qml
31 XrSimpleHapticEffect {
32 amplitude: 0.5
33 duration: 300
34 frequency: 3000
35 }
36 \endqml
37
38 \sa XrHapticFeedback
39*/
40
41/*!
42 \qmlproperty bool XrSimpleHapticEffect::amplitude()
43 \brief Defines the amplitude of the effect's vibration.
44 Acceptable values are from 0.0 to 1.0
45 \default 0.5
46 */
47float QQuick3DXrSimpleHapticEffect::amplitude()
48{
49 return m_amplitude;
50}
51
53{
54 if (m_amplitude == newAmplitude)
55 return;
56 m_amplitude = newAmplitude;
57 emit amplitudeChanged();
58}
59
60/*!
61 \qmlproperty bool XrSimpleHapticEffect::duration()
62 \brief Defines the duration of the haptic effect in milliseconds.
63 \default 30
64 */
66{
67 return m_duration;
68}
69
71{
72 if (m_duration == newDuration)
73 return;
74 m_duration = newDuration;
75 emit durationChanged();
76}
77
78/*!
79 \qmlproperty bool XrSimpleHapticEffect::frequency()
80 \brief Defines the frequency of the haptic effect in Hz
81 \default 3000
82 */
83
85{
86 return m_frequency;
87}
88
90{
91 if (m_frequency == newFrequency)
92 return;
93 m_frequency = newFrequency;
94 emit frequencyChanged();
95}
96
97QT_END_NAMESPACE