From 86c62fa1f17630d78d249bec2471f81c38bbd8df Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Wed, 17 Sep 2014 15:02:23 +0200 Subject: Fix a couple of issues in the maze example 1.) Remove dependency on QtSystemInfo. The module is not officially supported at this stage and screen saver related code is not really required for the example. 2.) Add AndroidManifest.xml to lock the screen orientation in portrait mode. Since the example depends on the tilt sensor a rotating UI is messing the game up. 3.) Port app to current TiltSensor API. The game works but its biggest problem remains the UI. It uses fixed-size UI elements which makes it tiny on High DPI screens. Task-number: QTBUG-31076 Change-Id: I73df9361b5171da930df66072e8ee9eba89b71ad Reviewed-by: Mitch Curtis --- examples/sensors/maze/android/AndroidManifest.xml | 56 +++++++++++++++++++++++ examples/sensors/maze/maze.pro | 7 ++- examples/sensors/maze/maze.qml | 8 ++-- examples/sensors/sensors.pro | 4 +- 4 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 examples/sensors/maze/android/AndroidManifest.xml (limited to 'examples') diff --git a/examples/sensors/maze/android/AndroidManifest.xml b/examples/sensors/maze/android/AndroidManifest.xml new file mode 100644 index 0000000..de787fa --- /dev/null +++ b/examples/sensors/maze/android/AndroidManifest.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/sensors/maze/maze.pro b/examples/sensors/maze/maze.pro index e4c4d86..f15fa57 100644 --- a/examples/sensors/maze/maze.pro +++ b/examples/sensors/maze/maze.pro @@ -1,16 +1,19 @@ TEMPLATE = app TARGET = maze -QT += quick +QT += quick sensors SOURCES = main.cpp OTHER_FILES = \ components \ $$files(*.qml) \ $$files(*.js) \ - content + content \ + android/AndroidManifest.xml target.path = $$[QT_INSTALL_EXAMPLES]/sensors/maze INSTALLS += target RESOURCES += \ maze.qrc + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android diff --git a/examples/sensors/maze/maze.qml b/examples/sensors/maze/maze.qml index eeaea28..19174a4 100644 --- a/examples/sensors/maze/maze.qml +++ b/examples/sensors/maze/maze.qml @@ -75,7 +75,6 @@ import "components" //! [0] import QtSensors 5.0 //! [0] -import QtSystemInfo 5.0 //Import the javascript functions for this game import "lib.js" as Lib @@ -86,7 +85,6 @@ ApplicationWindow { property Mouse mouseCtrl; property LabyrinthSquare cheeseSquare; property Congratulation congratulation; - ScreenSaver { screenSaverEnabled: !tiltTimer.running } Rectangle { id: gameRect @@ -171,9 +169,9 @@ ApplicationWindow { } //! [1] - TiltSensor{ + TiltSensor { id: tiltSensor - enabled: true + active: true } //! [1] @@ -185,7 +183,7 @@ ApplicationWindow { //! [2] onTriggered: { if (!tiltSensor.enabled) - tiltSensor.enabled = true; + tiltSensor.active = true; //! [2] if (mouseCtrl === null) diff --git a/examples/sensors/sensors.pro b/examples/sensors/sensors.pro index 6b994b8..20537a8 100644 --- a/examples/sensors/sensors.pro +++ b/examples/sensors/sensors.pro @@ -4,6 +4,7 @@ SUBDIRS += grue qtHaveModule(quick) { SUBDIRS += \ + maze \ qmlsensorgestures \ qmlqtsensors \ sensor_explorer \ @@ -19,7 +20,4 @@ qtHaveModule(widgets): SUBDIRS += \ qtHaveModule(3d): SUBDIRS += \ cubehouse -qtHaveModule(systeminfo): SUBDIRS += \ - maze - OTHER_FILES = stub.h -- cgit v1.2.1