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// Qt-Security score:significant reason:default
4
5
7
9
10/*!
11 \qmltype XrHapticEffect
12 \qmlabstract
13 \inherits QtObject
14 \inqmlmodule QtQuick3D.Xr
15 \brief Represents a haptic effect.
16 \since 6.9
17
18 XrHapticEffect defines the characteristics of the haptic effect.
19
20 This type is abstract. Use a subtype, such as \l XrSimpleHapticEffect.
21
22 \sa XrHapticFeedback XrSimpleHapticEffect
23 */
24
25/*!
26 \qmltype XrSimpleHapticEffect
27 \inherits XrHapticEffect
28 \inqmlmodule QtQuick3D.Xr
29 \brief Allows setting controller haptics using amplitude, duration and frequency.
30 \since 6.9
31
32 \qml
33 XrSimpleHapticEffect {
34 amplitude: 0.5
35 duration: 300
36 frequency: 3000
37 }
38 \endqml
39
40 \sa XrHapticFeedback
41*/
42
43/*!
44 \qmlproperty bool XrSimpleHapticEffect::amplitude()
45 \brief Defines the amplitude of the effect's vibration.
46 Acceptable values are from 0.0 to 1.0
47 \default 0.5
48 */
49float QQuick3DXrSimpleHapticEffect::amplitude()
50{
51 return m_amplitude;
52}
53
55{
56 if (m_amplitude == newAmplitude)
57 return;
58 m_amplitude = newAmplitude;
59 emit amplitudeChanged();
60}
61
62/*!
63 \qmlproperty bool XrSimpleHapticEffect::duration()
64 \brief Defines the duration of the haptic effect in milliseconds.
65 \default 30
66 */
68{
69 return m_duration;
70}
71
73{
74 if (m_duration == newDuration)
75 return;
76 m_duration = newDuration;
77 emit durationChanged();
78}
79
80/*!
81 \qmlproperty bool XrSimpleHapticEffect::frequency()
82 \brief Defines the frequency of the haptic effect in Hz
83 \default 3000
84 */
85
87{
88 return m_frequency;
89}
90
92{
93 if (m_frequency == newFrequency)
94 return;
95 m_frequency = newFrequency;
96 emit frequencyChanged();
97}
98
99QT_END_NAMESPACE
Combined button and popup list for selecting options.