How to get QAccelerometer working

So I’m trying to play with QAccelerometer
and it seems I can’t get the readingChanged property to get working.
I’m initializing it like this:

m_accel = std::unique_ptr(new QAccelerometer());
m_accel->setAxesOrientationMode(QSensor::AxesOrientationMode::UserOrientation);
m_accel->setDataRate(120);
QObject::connect(m_accel.get(), &QSensor::readingChanged, this, &PhoneMotion::updateSensor);
m_accel->start();

in the updateSensors I have just plain:

auto *areading = m_accel->reading();

which is just printing the x,y,z but it’s not doing it.So if someone has any idea what I’m missing it would be great :slight_smile:

1 Like

Bump, anyone has any idea @flypig maybe you can have some word from someone from Jolla about this issue?

MKPokerplanning uses the Accelerometer, maybe you can get some inspiration there

Thanks for the link, it’s using qml for that.

I’d look at messwerk:

Direct link: https://github.com/Bytewerk/Messwerk/blob/master/src/accelerometer.{h,cpp}

Thank you! I hope it will work as I want.