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