How to access the Qt5.2 Quick 2 gyroscope form on Android?

I created a simple Qt Quick 2 project. I want to access the gyro.

import QtQuick 2.1
import QtSensors 5.0

Rectangle {
    id: root
    color: "black"

    GyroscopeReading {
        onXChanged: {

        }
        onYChanged: {

        }
        onZChanged: {

        }
    }
}

In the .pro file, I added "QT + = sensors."

My application is not working. I see a white screen. In the output of the application, I see the "module" QtSensors "plugin" declarative_sensors "not found"

What am I doing wrong?

Thank!

+3
source share
1 answer

fixed this by making these changes to the QML file:

import QtSensors 5.0 as Sensors
...
Sensors.Accelerometer {
....
}

from here: http://qt-project.org/forums/viewthread/37033/

0
source

All Articles