If the target devices contain built-in sensors, such as an accelerometer, a compass, and ambient light or proximity sensors, you can use them to enable the following types of interaction:
- Changing application settings based on the ambient light conditions, such as bright sunshine or night time.
- Changing the screen orientation on the device from portrait to landscape as the device is rotated.
- Silencing an incoming call when the device orientation is changed (for example, on a table) from screen down to screen up and back again.
- Allowing movement gestures, such as device rotation, to trigger an action.
- In a map application, changing the orientation of a map based on the device compass orientation.
- Triggering an action when the device comes in close proximity to the user's hand or head.
You can test applications that use the Sensors module in the emulator. The Sensors view contains controls to set the values the sensors currently return.
Changing Light Conditions
Specify the ambient light state in the Ambient light field. The listed values correspond to predefined amounts of units of illuminance (LUX): 0, 10, 100, 500, 5 000. To test using other LUX values, specify them in the Light (LUX) field or use the slider to set the value.
The accelerometer sensor channel detects movement gestures, such as moving a target device up or down. The three-dimensional Cartesian coordinate system is used to illustrate direction of the acceleration, as shown in the figure below. The x and y axes define a plane where z-axis direction is perpendicular to the xy plane. When a device moves along an axis in the positive direction, the acceleration is positive. When the device moves in the negative direction, the acceleration is negative. For example, when a device moves along the x-axis to the direction of -x, the acceleration is negative.
A target device placed screen up on a desk experiences a force of approximately 9.8 on the z axis (that is, upwards). This is the proper acceleration the device experiences relative to freefall.
To emulate movement of the device:
- Click or right-click the image of the device in the Orientation field and hold down the mouse button to rotate the image.
- Click the rotation buttons buttons to rotate the image:
- Use the sliders to specify values for the x, y, and z axis in the Accelerometer x, Accelerometer y, and Accelerometer z fields.
The rotation sensor channel uses three angles, measured in degrees to define the orientation of the device in three-dimensional space. These angles are defined using right hand rotation with axes as defined by the right hand cartesian coordinate system.
Click or right-click the image of the device in the Orientation field and hold down the mouse button to apply the angles to the device. You can also click the rotation buttons. This allows you to test how the application handles the interaction related to rotating the device.
Select the Rotate window check box to synchronize rotation with the UI orientation setting in the Model view. When the check box is selected, the screen is auto-rotated to match the orientation of the device.
For more information about how the angles are applied, see Common Conventions.
The compass returns the azimuth of the device as degrees from magnetic north in a clockwise direction based on the top of the device.
Note: The top of the device is a fixed point and may not represent the orientation that the user is holding the device in.
The calibration status of the device must be accurate for the azimuth to be accurate. It takes some time to calibrate the magnetic north sensor and, even after being calibrated, it can become uncalibrated. So, for an application to be sure the data coming from the magnetic north sensor channel is accurate, it must monitor changes in the calibration property and inform the user if something needs to be done to recalibrate the sensor.
Use sliders to set the Compass calibration level and Compass azimuth values.
IR Proximity indicates how far away from the device the user is. Specify a value from 0 to 1.0 where 0.7 or higher indicate the user is close and lower values indicate the user is far away. Note that devices may not use 0.7 as their closeness threshold.
Proximity indicates how far away from the device the user is. Use the button to toggle between Near and Far distance.
Using a Fixed Timestamp
Many sensors update frequently, and therefore sensor readings done by the client application contain a fresh timestamp by default. To disable that and provide a fixed timestamp manually, select the Override radio button in the Timestamp group and specify a date and time.
You can emulate sensor gestures, such as shake, spin, drop, cover, and turnover.
To test how your application responds to sensor gestures, select them in the Sensor gestures field and click Send to trigger them.
Available under certain Qt licenses.
Find out more.