summaryrefslogtreecommitdiffstats
path: root/doc/src/examples
diff options
context:
space:
mode:
authorWolfgang Beck <wolfgang.beck@nokia.com>2012-05-17 12:27:18 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-24 03:06:56 +0200
commit17d908ba5205513e9ed0be33aebeb3736bda0326 (patch)
treeda04213540ee61853aab6b4260721f1badd703b2 /doc/src/examples
parent32e2d98ea438041e7e0c4df7e67053c5ee7527a7 (diff)
Unfork the examples.
Some examples were forked off and updated. Unfork by bringing these changes back (a later update will bring the other examples in line with this new style). The changes are primarily made up of file renaming. Also, JPG files have been converted to PNG. Some documentation updates have been done. Change-Id: Ib090abb5ebea2003d479d2336a23317f52b8c4d8 Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'doc/src/examples')
-rw-r--r--doc/src/examples/accelbubble.qdoc10
-rw-r--r--doc/src/examples/grue.qdoc14
-rw-r--r--doc/src/examples/maze.qdoc19
-rw-r--r--doc/src/examples/qmlqtsensors.qdoc26
-rw-r--r--doc/src/examples/sensor_explorer.qdoc57
-rw-r--r--doc/src/examples/sensorgestures.qdoc6
-rw-r--r--doc/src/examples/shakeit.qdoc41
7 files changed, 91 insertions, 82 deletions
diff --git a/doc/src/examples/accelbubble.qdoc b/doc/src/examples/accelbubble.qdoc
index 2d4bd88d..962bce67 100644
--- a/doc/src/examples/accelbubble.qdoc
+++ b/doc/src/examples/accelbubble.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \example sensors/accelbubble
+ \example QtSensors/accelbubble
\title Accel Bubble
\brief The AccelBubble example demonstrates the Legacy Accelerometer QML element.
\ingroup qtsensors-examples
@@ -36,19 +36,19 @@
Import the Legacy Sensors Declarative module.
-\snippet ../examples/sensors/accelbubble/main.qml 0
+\snippet ../examples/QtSensors/accelbubble/main.qml 0
Add an Accelerometer QML element.
-\snippet ../examples/sensors/accelbubble/main.qml 1
+\snippet ../examples/QtSensors/accelbubble/main.qml 1
The accelerometer might run too fast for what we need, so add a timer to read the accelerometer's readings.
-\snippet ../examples/sensors/accelbubble/main.qml 2
+\snippet ../examples/QtSensors/accelbubble/main.qml 2
Use the 'active' property to start the sensor
-\snippet ../examples/sensors/accelbubble/main.qml 3
+\snippet ../examples/QtSensors/accelbubble/main.qml 3
*/
diff --git a/doc/src/examples/grue.qdoc b/doc/src/examples/grue.qdoc
index 74283b07..a64528aa 100644
--- a/doc/src/examples/grue.qdoc
+++ b/doc/src/examples/grue.qdoc
@@ -57,7 +57,7 @@
*/
/*!
- \example sensors/grue/lib
+ \example QtSensors/grue/lib
\title Grue Sensor Definition
\brief The Grue sensor is defined in a library so that applications can use it.
@@ -78,7 +78,7 @@
*/
/*!
- \example sensors/grue/plugin
+ \example QtSensors/grue/plugin
\title Grue Sensor Implementation
\brief The Grue sensor implementation lives in a plugin that is loaded by the Qt Sensors library.
@@ -94,13 +94,13 @@
light sensor. In the start method, the backend should be sure to call the
sensorStopped() or sensorBusy() methods if it cannot start.
- \snippet ../examples/sensors/grue/plugin/gruesensorimpl.cpp start
+ \snippet ../examples/QtSensors/grue/plugin/gruesensorimpl.cpp start
The setReading method is needed so that the sensors library knows where the
readings are coming from. This backend has a local copy of the reading so
it passes a pointer to the function.
- \snippet ../examples/sensors/grue/plugin/gruesensorimpl.cpp setReading
+ \snippet ../examples/QtSensors/grue/plugin/gruesensorimpl.cpp setReading
However it is also possible to pass null to the setReading method in which
case the sensors library will create an instance and return a pointer.
@@ -123,7 +123,7 @@
*/
/*!
- \example sensors/grue/console_app
+ \example QtSensors/grue/console_app
\title Grue Sensor Console Application
\brief The Grue sensor console application demonstrates use of the Grue sensor.
@@ -135,7 +135,7 @@
*/
/*!
- \example sensors/grue/import
+ \example QtSensors/grue/import
\title Grue Sensor QML Import
\brief The Grue sensor QML import exports the GrueSensor class as a QML element.
@@ -145,7 +145,7 @@
*/
/*!
- \example sensors/grue/qml_app
+ \example QtSensors/grue/qml_app
\title Grue Sensor QML Application
\brief The Grue sensor QML application demonstrates use of the GrueSensor QML element.
diff --git a/doc/src/examples/maze.qdoc b/doc/src/examples/maze.qdoc
index 3b89271b..ed2aeabc 100644
--- a/doc/src/examples/maze.qdoc
+++ b/doc/src/examples/maze.qdoc
@@ -26,32 +26,33 @@
****************************************************************************/
/*!
- \example sensors/maze
- \title Maze example
+ \example QtSensors/QtSensors_maze
+ \title Qt Sensors - Maze QML Example
\ingroup qtsensors-examples
+ \image maze.png
+
+ \section2 Maze in QML
\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
+ \snippet ../examples/QtSensors/QtSensors_maze/QtSensors_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
+ \snippet ../examples/QtSensors/QtSensors_maze/QtSensors_maze.qml 1
Starting the sensor can be done by setting the 'enabled' property to true:
-\snippet ../examples/sensors/maze/Maze.qml 2
+ \snippet ../examples/QtSensors/QtSensors_maze/QtSensors_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
-
+ \snippet ../examples/QtSensors/QtSensors_maze/QtSensors_maze.qml 3
*/
diff --git a/doc/src/examples/qmlqtsensors.qdoc b/doc/src/examples/qmlqtsensors.qdoc
index d8173306..4c509392 100644
--- a/doc/src/examples/qmlqtsensors.qdoc
+++ b/doc/src/examples/qmlqtsensors.qdoc
@@ -26,43 +26,45 @@
****************************************************************************/
/*!
- \example sensors/qmlqtsensors
- \title Qt Sensors - Simple QML Example
+ \example QtSensors/QtSensors_qmlqtsensors
+ \title Qt Sensors - QML example
\ingroup qtsensors-examples
- \brief The Qt Sensors simple QML example demonstrates the QML sensors elements in the QtSensors 5 import.
- \image qmlqtsensors.jpg
+ \image qmlqtsensors.png
+
+ \section2 Qt Sensors in QML
+ \brief The QML QtSensors example demonstrates the QML sensors elements in the QtSensors 5 import.
+
-\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
+ \snippet ../examples/QtSensors/QtSensors_qmlqtsensors/QtSensors_qmlqtsensors.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
+ \snippet ../examples/QtSensors/QtSensors_qmlqtsensors/QtSensors_qmlqtsensors.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
+ \snippet ../examples/QtSensors/QtSensors_qmlqtsensors/QtSensors_qmlqtsensors.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
+ \snippet ../examples/QtSensors/QtSensors_qmlqtsensors/QtSensors_qmlqtsensors.qml 3
+ \snippet ../examples/QtSensors/QtSensors_qmlqtsensors/QtSensors_qmlqtsensors.qml 4
\l {QtSensors5::AmbientLightSensor} {AmbientLightSensor}
-\snippet ../examples/sensors/qmlqtsensors/main.qml 5
+ \snippet ../examples/QtSensors/QtSensors_qmlqtsensors/QtSensors_qmlqtsensors.qml 5
\l {QtSensors5::ProximitySensor} {ProximitySensor}
-\snippet ../examples/sensors/qmlqtsensors/main.qml 6
+ \snippet ../examples/QtSensors/QtSensors_qmlqtsensors/QtSensors_qmlqtsensors.qml 6
*/
diff --git a/doc/src/examples/sensor_explorer.qdoc b/doc/src/examples/sensor_explorer.qdoc
index d8c6a5f2..1f8e022c 100644
--- a/doc/src/examples/sensor_explorer.qdoc
+++ b/doc/src/examples/sensor_explorer.qdoc
@@ -26,60 +26,67 @@
****************************************************************************/
/*!
- \example sensors/sensor_explorer
- \title Sensor Explorer example
+ \example QtSensors/QtSensors_sensor_explorer
+ \title Qt Sensors - Explorer QML 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.
+ \image sensorexplorer.png
- \section1 Sensor Explorer QML Import
+ \section2 Sensor Explorer in QML
+ \brief The Sensor Explorer example demonstrates how to read the meta-data of available sensors.
- 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.
+ This example is divided into two parts:
- It consists of the code under the \c{import/} directory.
+ \list
+ \li A \l{Sensor Explorer QML Import}{C++ plug-in} that provides QML alternatives for QSensorExplorer, QPropertyInfo and the QSensorItem classes.
+ \li A QML Application that uses the QML alternatives to read the sensors meta-data and present it.
+ \endlist
- \section1 Sensor Explorer QML Application
This is a pure QML application that can be run from Qt Creator or directly using the
- \c qmlscene binary. This app won't work if it cannot locate its related import.
+ \c qmlscene binary. You should install the other C++ plug-in before trying to run
+ this example, otherwise it will not find its dependencies.
\code
qmlscene main.qml
\endcode
-\section2 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/qml_app/main.qml 0
+ \snippet ../examples/QtSensors/QtSensors_sensor_explorer/QtSensors_sensor_explorer.qml 0
Create a SensorExplorer QML item:
- \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 1
+ \snippet ../examples/QtSensors/QtSensors_sensor_explorer/QtSensors_sensor_explorer.qml 1
You can retrieve a list of all available sensors using the SensorExplorer:
- \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 2
+ \snippet ../examples/QtSensors/QtSensors_sensor_explorer/QtSensors_sensor_explorer.qml 2
To retrieve the properties of a SensorItem use:
- \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 3
+ \snippet ../examples/QtSensors/QtSensors_sensor_explorer/QtSensors_sensor_explorer.qml 3
Changing a property value can be done like:
- \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 4
+ \snippet ../examples/QtSensors/QtSensors_sensor_explorer/QtSensors_sensor_explorer.qml 4
+
+ Starting and stopping a sensor can be done like:
- Starting and stoping a sesnor can be done like:
+ \snippet ../examples/QtSensors/QtSensors_sensor_explorer/QtSensors_sensor_explorer.qml 5
+*/
+
+/*!
+ \example QtSensors/QtSensors_sensor_explorer/import
+ \title Sensor Explorer QML Import
+
+ \section2 Sensor Explorer Declarative Plugin
+ \brief The Sensor Explorer QML import exports the QSensorExplorer, QPropertyInfo and the QSensorItem class as a QML element.
- \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 5
+ This example creates the \e {Explorer 1.0} import.
+
+ \sa {Qt Sensors - Explorer QML example}
*/
+
diff --git a/doc/src/examples/sensorgestures.qdoc b/doc/src/examples/sensorgestures.qdoc
index 2fb1fe21..6da13c85 100644
--- a/doc/src/examples/sensorgestures.qdoc
+++ b/doc/src/examples/sensorgestures.qdoc
@@ -45,17 +45,17 @@
In order to know about custom signals that may be available, we need to ask the QSensorGestureManager about them,
Using the QSensorGesture::gestureIds() function, the manager will return a QStringList of known and valid gesture Ids.
- \snippet ../examples/sensors/sensorgestures/mainwindow.cpp 0
+ \snippet ../examples/QtSensors/sensorgestures/mainwindow.cpp 0
We can then use this to create a QSensorGesture object that we can use to connect signals to,
and start the detection process. A QSensorGesture object will take a list of one or more
recognizer ids in it's constructor.
- \snippet ../examples/sensors/sensorgestures/mainwindow.cpp 1
+ \snippet ../examples/QtSensors/sensorgestures/mainwindow.cpp 1
and later stop the detection process.
- \snippet ../examples/sensors/sensorgestures/mainwindow.cpp 2
+ \snippet ../examples/QtSensors/sensorgestures/mainwindow.cpp 2
The QSensorGesture object will contain all the signals of the valid requested recognizers found on the system.
diff --git a/doc/src/examples/shakeit.qdoc b/doc/src/examples/shakeit.qdoc
index 409077d8..fca2a9dd 100644
--- a/doc/src/examples/shakeit.qdoc
+++ b/doc/src/examples/shakeit.qdoc
@@ -26,40 +26,39 @@
****************************************************************************/
/*!
- \example sensors/shakeit
- \title ShakeIt! QML Sensor Gestures Example
+ \example QtSensors/QtSensors_shakeit
+ \title Qt Sensors - ShakeIt QML Example
\ingroup qtsensors-examples
+ \image shakeit.png
+
+ \section2 ShakeIt in QML
\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.
+ Writing a QML application that uses the Shake QML sensorgestures element requires the following steps:
- \snippet ../examples/sensors/shakeit/shakeit.qml 0
+ Import the Sensors Declarative module.
- Add a SensorGesture QML element.
+ \snippet ../examples/QtSensors/QtSensors_shakeit/QtSensors_shakeit.qml 0
- \snippet ../examples/sensors/shakeit/shakeit.qml 1
+ Add a SensorGesture QML element.
- 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/QtSensors/QtSensors_shakeit/QtSensors_shakeit.qml 1
- \snippet ../examples/sensors/shakeit/shakeit.qml 2
+ 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.
- Use the 'enabled' property to start the sensor gesture.
+ \snippet ../examples/QtSensors/QtSensors_shakeit/QtSensors_shakeit.qml 2
- \snippet ../examples/sensors/shakeit/shakeit.qml 3
+ Use the 'enabled' property to start the sensor gesture.
- Use the onDetected signal to do stuff.
+ \snippet ../examples/QtSensors/QtSensors_shakeit/QtSensors_shakeit.qml 3
- \snippet ../examples/sensors/shakeit/shakeit.qml 4
+ Use the onDetected signal to do stuff.
- There are additional gestures to shake which are supported:
- whip, twistRight, hover, cover, turnover and pickup.
+ \snippet ../examples/QtSensors/QtSensors_shakeit/QtSensors_shakeit.qml 4
+ There are additional gestures to shake which are supported:
+ whip, twistRight, hover, cover, turnover and pickup.
*/