From 8d2a6e427067027769e1f3c6322ae06620146396 Mon Sep 17 00:00:00 2001 From: Wolfgang Beck Date: Fri, 3 Feb 2012 14:31:49 +1000 Subject: Update Examples for SDK team Change-Id: Ib81ebf326a1ee4330a268c8d57934e3d77ea68bb Reviewed-by: Lincoln Ramsay --- doc/src/examples/maze.qdoc | 57 +++++++++++++++++++++ doc/src/examples/qmlqtsensors.qdoc | 68 +++++++++++++++++++++++++ doc/src/examples/sensor_explorer.qdoc | 95 +++++++++++++++++++++++++++++++++++ doc/src/examples/shakeit.qdoc | 65 ++++++++++++++++++++++++ 4 files changed, 285 insertions(+) create mode 100644 doc/src/examples/maze.qdoc create mode 100644 doc/src/examples/qmlqtsensors.qdoc create mode 100644 doc/src/examples/sensor_explorer.qdoc create mode 100644 doc/src/examples/shakeit.qdoc (limited to 'doc') diff --git a/doc/src/examples/maze.qdoc b/doc/src/examples/maze.qdoc new file mode 100644 index 00000000..3b89271b --- /dev/null +++ b/doc/src/examples/maze.qdoc @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example sensors/maze + \title Maze example + \ingroup qtsensors-examples + \brief The Maze example demonstrates the TiltSensor QML element. + \image maze.jpg + +\section1 Overview + To write a QML application that will use the TiltSensor QML sensors element you need to do the following steps: + + Import the QtSensors 5.x declarative plugin: + +\snippet ../examples/sensors/maze/Maze.qml 0 + + Add the Sensor QML elements into your qml file. + + In this example we use the TiltSensor with values based in degrees and an accuracy of 5 degree: + +\snippet ../examples/sensors/maze/Maze.qml 1 + + Starting the sensor can be done by setting the 'enabled' property to true: + +\snippet ../examples/sensors/maze/Maze.qml 2 + + To determine the walk direction of the mouse we use the following if -else statements: + +\snippet ../examples/sensors/maze/Maze.qml 3 + +*/ + diff --git a/doc/src/examples/qmlqtsensors.qdoc b/doc/src/examples/qmlqtsensors.qdoc new file mode 100644 index 00000000..4e997c8a --- /dev/null +++ b/doc/src/examples/qmlqtsensors.qdoc @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example sensors/qmlqtsensors + \title QML QtSensors example + \ingroup qtsensors-examples + \brief The QML QtSensors example demonstrates the QML sensors elements in the QtSensors 5 import. + \image qmlqtsensors.jpg + +\section1 Overview + To write a QML application that will use the QML sensors elements in the QtSensors 5 import you need to to the following steps: + + Import the QtSensors 5.x declarative plugin: + +\snippet ../examples/sensors/qmlqtsensors/main.qml 0 + + Add the Sensor QML elements into your qml file. + + In this example we use the TiltSensor: + +\snippet ../examples/sensors/qmlqtsensors/main.qml 1 + + The Tilt-, AmbientLight- and the Proximity QML element sensor have the 'enabled' property in common. + To start or stop the sensor set this property to true or false. + +\snippet ../examples/sensors/qmlqtsensors/main.qml 2 + + Reading the data can be done for each sensor type like following: + + \l {QtSensors5::TiltSensor} {TiltSensor} + +\snippet ../examples/sensors/qmlqtsensors/main.qml 3 +\snippet ../examples/sensors/qmlqtsensors/main.qml 4 + + \l {QtSensors5::AmbientLightSensor} {AmbientLightSensor} + +\snippet ../examples/sensors/qmlqtsensors/main.qml 5 + + \l {QtSensors5::ProximitySensor} {ProximitySensor} + +\snippet ../examples/sensors/qmlqtsensors/main.qml 6 +*/ + diff --git a/doc/src/examples/sensor_explorer.qdoc b/doc/src/examples/sensor_explorer.qdoc new file mode 100644 index 00000000..01ae17bc --- /dev/null +++ b/doc/src/examples/sensor_explorer.qdoc @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page sensor_explorer.html + \title Sensor Explorer example + \ingroup qtsensors-examples + \brief The Sensor Explorer example demonstrates how to read the meta-data of available sensors. + \image sensorexplorer.jpg + +\section1 Overview + This example contains 2 projects. + + A \l{Sensor Explorer QML Import} to make the sensors and their meta-data available to a QML application. + + A \l{Sensor Explorer QML Application} that represents the \l{Sensor Explorer QML Import} information to the user interface. +*/ + + +/*! + \example sensors/sensor_explorer/import + \title Sensor Explorer QML Import + \brief The Sensor Explorer QML import exports the QSensorExplorer, QPropertyInfo and the QSensorItem class as a QML element. + + This example creates the \e {Explorer 1.0} import. + + \sa {Sensor Explorer Example} +*/ + +/*! + \example sensors/sensor_explorer/qml_app + \title Sensor Explorer QML Application + \brief The Sensor Explorer QML application demonstrates use of the Explorer 1.0 import QML elements. + + This is a pure QML application that can be run from Qt Creator or directly using the + \c qmlscene binary. You should install the other projects before trying to run + this example or it will not be able to find its dependencies. + + \code + qmlscene main.qml + \endcode + + \sa {Sensor Explorer Example} + +\section1 Overview + To write a QML application that will use the Explorer QML element you need to do the following steps: + + Import the Explorer 1.0 declarative plugin: + + \snippet ../examples/sensors/sensor_explorer/main.qml 0 + + Create a SensorExplorer QML item: + + \snippet ../examples/sensors/sensor_explorer/main.qml 1 + + You can retrieve a list of all available sensors using the SensorExplorer: + + \snippet ../examples/sensors/sensor_explorer/main.qml 2 + + To retrieve the properties of a SensorItem use: + + \snippet ../examples/sensors/sensor_explorer/main.qml 3 + + Changing a property value can be done like: + + \snippet ../examples/sensors/sensor_explorer/main.qml 4 + + Starting and stoping a sesnor can be done like: + + \snippet ../examples/sensors/sensor_explorer/main.qml 5 +*/ diff --git a/doc/src/examples/shakeit.qdoc b/doc/src/examples/shakeit.qdoc new file mode 100644 index 00000000..409077d8 --- /dev/null +++ b/doc/src/examples/shakeit.qdoc @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms +** and conditions contained in a signed written agreement between you +** and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example sensors/shakeit + \title ShakeIt! QML Sensor Gestures Example + \ingroup qtsensors-examples + \brief The sensor gesture example demonstrates the steps for creating a QML application + that uses sensor gestures and the included shake sensor. + \image shakeit.jpg + + \section1 Overview + Writing a QML application that uses the Shake QML sensorgestures element + requires the following steps: + + Import the Sensors Declarative module. + + \snippet ../examples/sensors/shakeit/shakeit.qml 0 + + Add a SensorGesture QML element. + + \snippet ../examples/sensors/shakeit/shakeit.qml 1 + + In the SensorGesture element, specify which gesture to be used. + Note that this can be a comma separated list. Here we are only interested in one + gesture recognizer. + + \snippet ../examples/sensors/shakeit/shakeit.qml 2 + + Use the 'enabled' property to start the sensor gesture. + + \snippet ../examples/sensors/shakeit/shakeit.qml 3 + + Use the onDetected signal to do stuff. + + \snippet ../examples/sensors/shakeit/shakeit.qml 4 + + There are additional gestures to shake which are supported: + whip, twistRight, hover, cover, turnover and pickup. + +*/ -- cgit v1.2.3