Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.5
- import Sailfish.Silica 1.0
- import QtSensors 5.2
- Page {
- OrientationSensor {
- id: orientationSensor
- active: true
- }
- Image {
- anchors.centerIn: parent
- scale: Math.min(parent.width, parent.height) / Theme.iconSizeMedium
- source: "image://theme/icon-m-capslock"
- rotation: {
- if (!orientationSensor.reading) return 0;
- switch (orientationSensor.reading.orientation) {
- case OrientationReading.TopUp: return 0;
- case OrientationReading.RightUp: return 90;
- case OrientationReading.TopDown: return 180;
- case OrientationReading.LeftUp: return 270;
- default: return 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement