Details
-
User Story
-
Resolution: Out of scope
-
P2: Important
-
None
-
None
Description
Sensors are aligned to something, the app needs to know what. The app should also be able to request re-alignment without difficulty.
Since it's ultimately up to the backend, we can't force this. For example, doing this on Symbian requires some major changes to system-level software (or really crazy maths in the backend).
bool ok = sensor->setAlignment(QSensor::AlignToPortrait); QSensor::Alignment al = sensor->alignment();
Implementation Plan
Add an alignment() and setAlignment() method. setAlignment() returns bool so we can fail. alignment() always returns what alignment is in use.
There will be 5 alignments.
- Portrait (default)
- InvertedPortrait
- Landscape
- InvertedLandscape
- Auto
The first 4 lock sensor data to a particular orientation. The last one changes sensor data orientation when the screen rotation changes.
There may be a point when we decide it's worthwhile having Auto as the default instead of Portrait but for now, doing that might break apps.
It may be necessary for the platform to be able to refuse some of these but... that would make this API useless so there would need to be some really good reasons why a backend couldn't handle this (or even why it couldn't just be done in QtSensors itself).
Notes
The QML API needs to have a property tied to this.
Research Questions
What does example app code look like?
What needs to change in the backend for this to work?
How can this work in a multitasking environment (ie. with multiple apps that want different alignments)?
How can we unit test this?
How can we document this?
Acceptance Criteria
- An API exists and is accessible from C++ and QML (for all sensors).
- User Stories exist for implementation of the code.