Qt/QML on Android - onReadingChanged

Qt/QML on Android - onReadingChanged

本文关键字:onReadingChanged Android on QML Qt      更新时间:2023-10-16

我一步一步地遵循了非常好的Digia示例在Android上运行Qt/QML。

当我从IDE-Qt单击[构建]时,输出看起来不错:

Running steps for project bubble...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" 
make: Nothing to be done for `first'.
The process "/usr/bin/make" exited normally.
Elapsed time: 00:00.

[运行QMake]

Running steps for project bubble...
Starting: "/.../qt5/creator/Qt5.1.1/5.1.1/gcc_64/bin/qmake" /~/Desktop/bubble/bubble.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
The process "/.../qt5/creator/Qt5.1.1/5.1.1/gcc_64/bin/qmake" exited normally.

[运行]

QML debugging is enabled. Only use this in a safe environment.
QQmlApplicationEngine failed to load component 
qrc:///bubble.qml:38 Cannot assign to non-existent property "onReadingChanged"

我还读到qmlviewer在Qt5上没有更多地使用:未安装 qmlviewer 。

Android SDK NDK 已安装,设备已启用并处于开发人员模式,并且由于错误消息仅抱怨 QML,我想这不应该是应用程序无法运行的原因。

欢迎所有建议。

您的传感器未正确设置/激活。试试这个:

OrientationSensor {
 id: orientation
 active: true
 onReadingChanged: {
     if (reading.orientation == OrientationReading.FaceUp)
         content.state = "FaceUp";
     // ... more tests for different orientations ...
 }
}

有关更多信息,请查看QtMobility。

相关文章:
  • 没有找到相关文章