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-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On 
Behalf Of ext Ben Marinic
Sent: Thursday, July 29, 2010 7:16 PM
To: qt-qml@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. b...@combinationstudios.com<mailto:b...@combinationstudios.com>
t. +44 (0)20 7193 2000
m. +44 (0)7813 147 159





_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to