本页内容

QAccelerometerReading Class

QAccelerometerReading 类用于报告沿 X、Y 和 Z 轴的线性加速度。更多内容...

标题: #include <QAccelerometerReading>
CMake: find_package(Qt6 REQUIRED COMPONENTS Sensors)
target_link_libraries(mytarget PRIVATE Qt6::Sensors)
qmake: QT += sensors
继承自: QSensorReading

属性

  • x : qreal
  • y : qreal
  • z : qreal

公共函数

void setX(qreal x)
void setY(qreal y)
void setZ(qreal z)
qreal x() const
qreal y() const
qreal z() const

详细说明

QAccelerometerReading Units

值的量纲为米每秒平方。各轴的排列如下。

一种具有正负x、y和z加速度轴且这三个轴方向延伸至所有六个方向的设备

一个静止的单块设备,正面朝上放置在桌面上时,将在 Z 轴方向(即朝向天花板方向)受到约 9.8 的力。这是该设备相对于自由落体所经历的正向加速度。

属性文档

[read-only] x : qreal

该属性表示X轴方向上的加速度。

该值的单位为米每秒平方。

访问函数:

qreal x() const

另请参阅 QAccelerometerReading Units 。

[read-only] y : qreal

该属性存储Y轴方向的加速度。

该值的单位为米每秒平方。

访问函数:

qreal y() const

另请参阅 QAccelerometerReading Units 。

[read-only] z : qreal

该属性存储Z轴上的加速度。

该值的单位为米每秒平方。

访问函数:

qreal z() const

另请参阅 QAccelerometerReading Units 。

成员函数文档

void QAccelerometerReading::setX(qreal x)

将X轴的加速度设置为x 。

另请参阅 x()。

void QAccelerometerReading::setY(qreal y)

将Y轴的加速度设置为y 。

另请参阅 y()。

void QAccelerometerReading::setZ(qreal z)

将Z轴的加速度设置为z 。

另请参阅 z()。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.