Skip to content

A library that will rotate the screen depending on device orientation

Notifications You must be signed in to change notification settings

wolfmanjm/qtrotate

Repository files navigation

ported to qtextended by Jim Morris morris@wolfman.com http://blog.wolfman.com

A simple self contained routine that will enable a QTE app to rotate
the screen depending on orientation

To use...
#include "rotate.h"

// create an instance of RotateHelper

RotateHelper *rh= new RotateHelper();

// then start it off..

rh->start(); // the default sample rate is 500ms

// to stop it...
rh->stop();

// to restore to upright...
rh->restore();

// to see if the current orientation is landscape...
rh->isLandscape();

// to get a signal when the screen orientation changes...
connect(rotate, SIGNAL(rotated(bool)), this, SLOT(rotated(bool)));

// Then the slot rotated(bool landscape) will be called with true if the new orientation is landscape

The only files you need to put in your project are rotate.h and rotate.cpp

You can always get the current rotation in degrees using Qte...

QValueSpaceItem vsiRot("/UI/Rotation/Current");
int rotation_in_degrees= vsiRot.value().toUInt();

About

A library that will rotate the screen depending on device orientation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages