QAxisAccumulator Class
(Qt3DInput::QAxisAccumulator)QAxisAccumulator processes velocity or acceleration data from a QAxis. 更多...
头文件: | #include <QAxisAccumulator> |
qmake: | QT += 3dinput |
开始支持版本: | Qt 5.8 |
Instantiated By: | AxisAccumulator |
基类: | Qt3DCore::QComponent |
公有类型
enum | SourceAxisType { Velocity, Acceleration } |
属性
|
- 1 个属性继承自 Qt3DCore::QComponent
- 3 个属性继承自 Qt3DCore::QNode
- 1 个属性继承自 QObject
公有函数
QAxisAccumulator(Qt3DCore::QNode *parent = nullptr) | |
float | scale() const |
Qt3DInput::QAxis * | sourceAxis() const |
SourceAxisType | sourceAxisType() const |
float | value() const |
float | velocity() const |
- 2 个公有函数继承自 Qt3DCore::QComponent
- 11 个公有函数继承自 Qt3DCore::QNode
- 32 个公有函数继承自 QObject
公有槽函数
void | setScale(float scale) |
void | setSourceAxis(Qt3DInput::QAxis *sourceAxis) |
void | setSourceAxisType(QAxisAccumulator::SourceAxisType sourceAxisType) |
- 1 个公有槽函数继承自 Qt3DCore::QComponent
- 3 个公有槽函数继承自 Qt3DCore::QNode
- 1 个公有槽函数继承自 QObject
信号
void | scaleChanged(float scale) |
void | sourceAxisChanged(Qt3DInput::QAxis *sourceAxis) |
void | sourceAxisTypeChanged(QAxisAccumulator::SourceAxisType sourceAxisType) |
void | valueChanged(float value) |
void | velocityChanged(float value) |
- 3 个信号继承自 Qt3DCore::QComponent
- 4 个信号继承自 Qt3DCore::QNode
- 2 个信号继承自 QObject
其他继承的成员
- 1 个公有变量继承自 QObject
- 10 个静态公有成员继承自 QObject
- 2 个受保护的函数继承自 Qt3DCore::QNode
- 9 个受保护的函数继承自 QObject
- 2 个受保护的变量继承自 QObject
详细描述
Constructs a new QAxisAccumulator instance with parent.
QAxisAccumulator processes velocity or acceleration data from a QAxis.
A Qt3DInput::QAxis reports the current position of an axis on an input device. When the axis is returned to its neutral position the value of that axis returns to 0. Often, it is required to have the input from an axis control a variable in other ways, for example treating the value from the Qt3DInput::QAxis as a velocity (first derivative with respect to time) or as an acceleration (second derivative with respect to time). This can be done with user code or with a Qt3DLogic::QFrameAction but those approached are not ideal as they add more work to the main thread and are inherently imperative. The Qt3DInput::QAxisAccumulator class allows for this common task to be performed on the Qt 3D backend and be specified in a declarative manner.
成员类型
enum QAxisAccumulator::SourceAxisType
Constant | Value |
---|---|
Qt3DInput::QAxisAccumulator::Velocity | 0 |
Qt3DInput::QAxisAccumulator::Acceleration | 1 |
属性
scale : float
访问函数:
float | scale() const |
void | setScale(float scale) |
Notifier signal:
void | scaleChanged(float scale) |
sourceAxis : Qt3DInput::QAxis *
访问函数:
Qt3DInput::QAxis * | sourceAxis() const |
void | setSourceAxis(Qt3DInput::QAxis *sourceAxis) |
Notifier signal:
void | sourceAxisChanged(Qt3DInput::QAxis *sourceAxis) |
sourceAxisType : SourceAxisType
访问函数:
SourceAxisType | sourceAxisType() const |
void | setSourceAxisType(QAxisAccumulator::SourceAxisType sourceAxisType) |
Notifier signal:
void | sourceAxisTypeChanged(QAxisAccumulator::SourceAxisType sourceAxisType) |
value : const float
访问函数:
float | value() const |
Notifier signal:
void | valueChanged(float value) |
velocity : const float
访问函数:
float | velocity() const |
Notifier signal:
void | velocityChanged(float value) |
成员函数
QAxisAccumulator::QAxisAccumulator(Qt3DCore::QNode *parent = nullptr)
Constructs a new QAxisAccumulator instance with parent parent.
float QAxisAccumulator::scale() const
The amount to scale the axis value by when accumulating. This can be thought of as the maximum velocity or acceleration the axis can control.
Returns the amount the input axis values are scaled by.
Note: Getter function for property scale.
参见 setScale().
[slot]
void QAxisAccumulator::setSourceAxisType(QAxisAccumulator::SourceAxisType sourceAxisType)
Sets how the accumulator treats the values originating from the sourceAxisType.
Note: Setter function for property sourceAxisType.
参见 sourceAxisType().
Qt3DInput::QAxis *QAxisAccumulator::sourceAxis() const
Returns QAxis for which the accumulator should integrate axis values.
Note: Getter function for property sourceAxis.
参见 setSourceAxis().
SourceAxisType QAxisAccumulator::sourceAxisType() const
Returns how the accumulator treats the value of the sourceAxis.
Note: Getter function for property sourceAxisType.
参见 setSourceAxisType().
float QAxisAccumulator::value() const
Returns the accumulated (integrated) value.
Note: Getter function for property value.
float QAxisAccumulator::velocity() const
Returns the velocity. If the sourceAxisType is set to Velocity this is simply the value of the source axis multiplied by the scale. If the sourceAxisType is set to Acceleration, the velocity is integrated using the source axis' value as an acceleration.
Note: Getter function for property velocity.