diff options
Diffstat (limited to 'examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc')
-rw-r--r-- | examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc b/examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc index be04215..b40bf39 100644 --- a/examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc +++ b/examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc @@ -27,30 +27,45 @@ /*! \example sensor_explorer - \title Qt Sensors - Explorer QML example + \title Qt Sensors - Explorer QML Example \ingroup qtsensors-examples + \brief Demonstrates how to read the meta-data of available sensors. - \section2 Sensor Explorer in QML - \brief The Sensor Explorer example demonstrates how to read the meta-data of available sensors. - + \image qtsensors-examples-explorer.png This example is divided into two parts: \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. + \li A \l{Sensor Explorer QML Import}{C++ plugin} that provides QML + alternatives for \c QSensorExplorer, \c QPropertyInfo and + \c QSensorItem C++ classes. + \li A \l{Sensor Explorer QML Application}{QML Application} that uses + the QML types to read the sensor meta-data and present it. \endlist - - 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 C++ plug-in before trying to run - this example, otherwise it will not find its dependencies. + This example is built as an executable with C++ code that runs the QML, + but it can also be launched directly using the \c qmlscene tool. You + should build the top-level \e sensor_explorer project before trying to + run this example or it will not be able to find its dependencies. \code - qmlscene main.qml + qmlscene -I . sensor_explorer.qml \endcode - To write a QML application that will use the Explorer QML type you need to do the following steps: + Above, the -I . parameter adds the current directory as a module import + path to locate the Explorer QML module. + + \section1 Sensor Explorer QML Import + + The Sensor Explorer QML import defines the \e Explorer QML module, + exporting \c QSensorExplorer, \c QPropertyInfo and \c QSensorItem C++ + classes as QML types. The source code is available in the + \c sensor_explorer/import subdirectory. + + \section1 Sensor Explorer QML Application + + To write a QML application that will use the QML types exposed by the + Explorer module, following steps are needed: Import the Explorer 1.0 declarative plugin: @@ -60,32 +75,30 @@ \snippet sensor_explorer/sensor_explorer.qml 1 - You can retrieve a list of all available sensors using the SensorExplorer: + You can retrieve a list of all available sensors using + \c SensorExplorer.availableSensors: \snippet sensor_explorer/sensor_explorer.qml 2 - To retrieve the properties of a SensorItem use: + The example uses the returned list as a model to populate a view of + available sensors. + + To retrieve the properties of a sensor, use \c SensorItem.properties: \snippet sensor_explorer/sensor_explorer.qml 3 - Changing a property value can be done like: + The property list is used as a model for another view that displays the + property names and values. + + It is possible to edit the values of certain sensor properties. Selecting + a writable property value will open an editor. \c SensorExplorer QML + type allows you to pass a new value for a sensor property value as + follows: \snippet sensor_explorer/sensor_explorer.qml 4 - Starting and stopping a sensor can be done like: + Starting and stopping a sensor can be done by setting the + \c SensorItem.start property: \snippet sensor_explorer/sensor_explorer.qml 5 */ - -/*! - \example 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 type. - - This example creates the \e {Explorer 1.0} import. - - \sa {Qt Sensors - Explorer QML example} -*/ - |