Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

Rotation

Introduction

Qt Extended provides support for dynamic screen rotation. This means Qt Extended can be oriented 90, 180, and 270 degrees from the default aspect.

Overview

To use dynamic rotation you need to configure Qt Extended with:

    -dynamic-rotation

which enables the Transformed screen driver plugin and turns on the QT_QWS_DYNAMIC_TRANSFORMATION define.

The transformed driver needs to be enabled by setting the QWS_DISPLAY variable in the defautbuttons.conf file to the "Transformed" driver, as such:

    [Environment]
     QWS_DISPLAY=Transformed:mmWidth43:mmHeight58:Rot0:0

or as an environmental variable in the Qt Extended startup script:

    export QWS_DISPLAY=Transformed:mmWidth43:mmHeight58:Rot0:0

QVFb can be used to display dynamic rotation, and can be rotated itself to help faciliate development of rotated applications.

To rotate the QVfb application (thus rotating the phone skin), right click anywhere on the QVFb skin, select "View", then select one of the following rotation entries: No, 90, 180, or 270 rotation. It is then easier to see the Qt Extended in rotated mode.

Example

The Rotation settings application is an example of user based rotation.

A device integrator could also want to automatically rotate the screen depending on which way the user holds the device, if the device has motion sensors.

To rotate the screen 270 degrees clockwise, send a request to the RotationManager:

       QtopiaServiceRequest svreq("RotationManager", "setCurrentRotation(int)");
       svreq << 270;
       svreq.send();

To set the display back to the default orientation:

       QtopiaServiceRequest svreq("RotationManager", "defaultRotation()");
       svreq.send();

Applications that need to access the current and default screen orientation values may use a QValueSpaceItem defined in the RotationManager.

        QValueSpaceItem *currentRotation = new QValueSpaceItem("/UI/Rotation/Current");
        int currentRot = currentRotation->value().toUInt();

        QValueSpaceItem *defaultRotation = new QValueSpaceItem("/UI/Rotation/Default");
        int defaultRot = defaultRotation->value().toUInt();


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3