Qt; how to get screen orientation corrected compass value (in c++ part)?

349 views Asked by At

My intention was to show the user where north is relative to how he views the screen inside a Qt Quick 2.0 app

So I took the Compass class from the Qt sensors package, and it works fine if I hold my phone in portrait mode, but if I call QCompass.isFeatureSupported(QSensor::AxesOrientation) it returns false, so letting Qt correct the compass value with the device orientation apparently fails

So what is the easiest way to get the heading of the device* in the c++ part of a Qt Quick application?

It has to work on both iOS & Android, preferably relying on Qt as much as possible.

  • my app needs to support all screen orientations, basically if an up arrow (^) is drawn on the screen I want the real world direction it points towards in the 2D plane (comparable to a normal compass) regardless how the user holds the device
0

There are 0 answers