[Qt-qml] Orientation listener

joona.t.petrell at nokia.com joona.t.petrell at nokia.com
Mon Aug 2 09:13:56 CEST 2010


Hi Ben,

QML Viewer provides a simple context property runtime.orientation for listening to orientation changes on a device. It can update to four different values: portrait, portrait inverted, landscape and landscape inverted. Currently the property is updated on N900 and Symbian S60 5.0 and newer devices. For more information, see http://doc.trolltech.com/4.7-snapshot/qmlviewer.html.

For more complex orientation handling, you are better off using Sensor APIs from Qt Mobility:
http://doc.trolltech.com/qtmobility-1.1-tp/sensors-api.html

Qt Mobility teams are working on providing QML bindings for their APIs:
http://labs.trolltech.com/blogs/2010/07/27/qt-mobility-110-technology-preview/

The QML syntax will be something like

import QtMobility.sensors 1.1

OrientationSensor {
    active: true
    onReadingChanged: {
        console.log("New orientation: " + reading.orientation);
    }
}

Cheers,

Joona

From: qt-qml-bounces at trolltech.com [mailto:qt-qml-bounces at trolltech.com] On Behalf Of ext Ben Marinic
Sent: Thursday, July 29, 2010 7:16 PM
To: qt-qml at trolltech.com
Subject: [Qt-qml] Orientation listener

Hi

I need to listen for orientation changes in my QML view.  Specifically the following:  tilt right, tilt left, point up, point down, tip forward, upwards and downwards.  I can see through some old list serv threads that the syntax has changed a little over time (binding to orientations).  What is the current method for listening and executing a function on an orientation change in QML?

Thanks
Ben

Ben Marinic
Combination Studios Ltd
e. ben at combinationstudios.com<mailto:ben at combinationstudios.com>
t. +44 (0)20 7193 2000
m. +44 (0)7813 147 159





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100802/2c2954ed/attachment.html 


More information about the Qt-qml mailing list