×
Namespaces

Variants
Actions
(Difference between revisions)

QtOrientationTest

From Nokia Developer Wiki
Jump to: navigation, search
axeljaeger (Talk | contribs)
m (Replace youtube URL because a new upload on youtube was necessary to give the video a proper title and description.)
axeljaeger (Talk | contribs)
(Update to no longer use own emulator)
Line 12: Line 12:
 
=Overview=
 
=Overview=
 
The QtOrientationTest shows shows how to obtain the device orientation and adopt the user interface accordingly. An arrow is shown on the display that is pointing "upwards". If the device is flat on the table or face down, either a circle with a dot or a cross is shown, meaning you look to the pointy end of the arrow or from the back to the fletchings.
 
The QtOrientationTest shows shows how to obtain the device orientation and adopt the user interface accordingly. An arrow is shown on the display that is pointing "upwards". If the device is flat on the table or face down, either a circle with a dot or a cross is shown, meaning you look to the pointy end of the arrow or from the back to the fletchings.
 
The original version of this example used the deprecated so called  "[[Mobile_Extensions|Qt Mobile Extensions]]"  but has been updated now to the new Qt Mobility-APIs. As soon as the emulator of the new Nokia Qt SDK is capable of simulating all orientations of QOrientationSensor, the example will be updated again and will no longer bring its own simulator.
 
  
 
=In action=
 
=In action=
 
See the application in action on youtube:  
 
See the application in action on youtube:  
 
 
{{#ev:youtube|-R8zATxLW80}}
 
{{#ev:youtube|-R8zATxLW80}}
  
 
=Testing the application=
 
=Testing the application=
The example is either be meant to be compiled directly for the device or as a desktop application. When compiled for the device, the real sensor API is used.
+
The example is meant to be run either on a symbian device or in the simulator of the Nokia Qt SDK.
When compiled as a desktop application, a stub implementation of the sensor API is used that shows a window with 6 buttons to set the orientation.
+
  
Because of the usage of sensors from the QtMobility-APIs, ReadDeviceData-capability is needed. This capability cannot be granted to a self signed application. Use symbian signed online to test.
+
Because of the usage of sensors from the QtMobility-APIs, ReadDeviceData-capability is needed on symbian. This capability cannot be granted to a self signed application. Use symbian signed online to test.  
  
==Download Code Example==
+
=Download=
 
[[File:Orientationtest.zip]]
 
[[File:Orientationtest.zip]]
 +
 +
=Planed updates=
 +
As soon as Nokia publishes an official API to lock the screen orientation and thus disabling auto rotation, the example will be updated and then also work on maemo/maego. Currently there is stil a bit of native code to lock screen orientation on symbian. No such code is provided for Maemo.
 +
 +
=History=
 +
{| border="1"
 +
|29 March 2010
 +
|Initial version that was submitted to the QtMobility-contest. This one was actually not using QtMobility but the so called "[[Mobile_Extensions|Qt Mobile Extensions]]"
 +
|-
 +
|1 August 2010
 +
|Updated version that now uses the new sensor API from QtMobility
 +
|-
 +
|19 September 2010
 +
|Updated version that no longer uses an own emulator because simulator from Nokia Qt SDK from version 1.0.1 supports setting orientations when using the scripts provided here http://bugreports.qt.nokia.com/browse/QTSIM-63
 +
|}
  
 
[[Category:Code Examples]]
 
[[Category:Code Examples]]

Revision as of 01:24, 20 September 2010

Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic, Nokia N97 mini
Compatibility
Platform(s): S60 5th Edition
Symbian
S60 5th Edition
Article
Keywords: Orientation, Sensor, Accelerometer
Created: (29 Mar 2010)
Last edited: axeljaeger (20 Sep 2010)

Contents

Overview

The QtOrientationTest shows shows how to obtain the device orientation and adopt the user interface accordingly. An arrow is shown on the display that is pointing "upwards". If the device is flat on the table or face down, either a circle with a dot or a cross is shown, meaning you look to the pointy end of the arrow or from the back to the fletchings.

In action

See the application in action on youtube:


Testing the application

The example is meant to be run either on a symbian device or in the simulator of the Nokia Qt SDK.

Because of the usage of sensors from the QtMobility-APIs, ReadDeviceData-capability is needed on symbian. This capability cannot be granted to a self signed application. Use symbian signed online to test.

Download

File:Orientationtest.zip

Planed updates

As soon as Nokia publishes an official API to lock the screen orientation and thus disabling auto rotation, the example will be updated and then also work on maemo/maego. Currently there is stil a bit of native code to lock screen orientation on symbian. No such code is provided for Maemo.

History

29 March 2010 Initial version that was submitted to the QtMobility-contest. This one was actually not using QtMobility but the so called "Qt Mobile Extensions"
1 August 2010 Updated version that now uses the new sensor API from QtMobility
19 September 2010 Updated version that no longer uses an own emulator because simulator from Nokia Qt SDK from version 1.0.1 supports setting orientations when using the scripts provided here http://bugreports.qt.nokia.com/browse/QTSIM-63
105 page views in the last 30 days.