简体   繁体   English

Android上的Qt / QML - onReadingChanged

[英]Qt/QML on Android - onReadingChanged

I followed step by step the very nice Digia example to run Qt/QML on Android . 我一步一步地按照非常好的Digia示例在Android上运行Qt / QML

When I click [build] from IDE-Qt, the output looks nice: 当我从IDE-Qt单击[build]时,输出看起来不错:

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.

[Run QMake] [运行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.

[Run] [跑]

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"

I also read that qmlviewer is not more in use on Qt5: No qmlviewer installed . 我还读到qtviewer在Qt5上没有更多使用: 没有安装qmlviewer

Android SDK NDK is installed, and the device is enabled and on developer mode, and as the error message only complains about QML, I guess it shouldn't be the reason for the App not be running. 安装了Android SDK NDK,并且设备已启用且处于开发人员模式,并且因为错误消息只是抱怨QML,我想这不应该是应用程序无法运行的原因。

All suggestions are welcome. 欢迎所有建议。

Your sensor was not properly set/activated. 您的传感器未正确设置/激活。 Try this: 尝试这个:

OrientationSensor {
 id: orientation
 active: true

 onReadingChanged: {

     if (reading.orientation == OrientationReading.FaceUp)
         content.state = "FaceUp";

     // ... more tests for different orientations ...
 }
}

For further info, get a look in QtMobility . 有关详细信息,请查看QtMobility

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM