1// Copyright (C) 2016 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#ifndef QT3DINPUT_QAXISACCUMULATOR_H
5#define QT3DINPUT_QAXISACCUMULATOR_H
6
7#include <Qt3DInput/qt3dinput_global.h>
8#include <Qt3DInput/qaxis.h>
9#include <Qt3DCore/qcomponent.h>
10
11QT_BEGIN_NAMESPACE
12
13namespace Qt3DInput {
14
15class QAxisAccumulatorPrivate;
16
17class Q_3DINPUTSHARED_EXPORT QAxisAccumulator : public Qt3DCore::QComponent
18{
19 Q_OBJECT
20 Q_PROPERTY(Qt3DInput::QAxis *sourceAxis READ sourceAxis WRITE setSourceAxis NOTIFY sourceAxisChanged)
21 Q_PROPERTY(SourceAxisType sourceAxisType READ sourceAxisType WRITE setSourceAxisType NOTIFY sourceAxisTypeChanged)
22 Q_PROPERTY(float scale READ scale WRITE setScale NOTIFY scaleChanged)
23 Q_PROPERTY(float value READ value NOTIFY valueChanged)
24 Q_PROPERTY(float velocity READ velocity NOTIFY velocityChanged)
25
26public:
27 enum SourceAxisType {
28 Velocity,
29 Acceleration
30 };
31 Q_ENUM(SourceAxisType) // LCOV_EXCL_LINE
32
33 QAxisAccumulator(Qt3DCore::QNode *parent = nullptr);
34 ~QAxisAccumulator();
35
36 Qt3DInput::QAxis *sourceAxis() const;
37 SourceAxisType sourceAxisType() const;
38 float value() const;
39 float velocity() const;
40 float scale() const;
41
42public Q_SLOTS:
43 void setSourceAxis(Qt3DInput::QAxis *sourceAxis);
44 void setSourceAxisType(QAxisAccumulator::SourceAxisType sourceAxisType);
45 void setScale(float scale);
46
47Q_SIGNALS:
48 void sourceAxisChanged(Qt3DInput::QAxis *sourceAxis);
49 void sourceAxisTypeChanged(QAxisAccumulator::SourceAxisType sourceAxisType);
50 void valueChanged(float value);
51 void velocityChanged(float value);
52 void scaleChanged(float scale);
53
54private:
55 Q_DECLARE_PRIVATE(QAxisAccumulator)
56};
57
58} // namespace Qt3DInput
59
60QT_END_NAMESPACE
61
62#endif // QT3DINPUT_QAXISACCUMULATOR_H
63

source code of qt3d/src/input/frontend/qaxisaccumulator.h