From a840cbffba476205eba81f56f40ec32cea6097cc Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 28 Aug 2013 11:26:38 +0200 Subject: Doc: Update Sensor Explorer example Following changes are made to the example - Use of Qt Quick Controls / TableView to present the sensor information, reducing the example to a single QML file - Updated launcher main.cpp for the QML example - Remove separate example doc for the import subproject - Various fixes to example doc, add a screenshot - Ensure import module + qmldir are built/deployed to correct location Task-number: QTBUG-32881 Task-number: QTBUG-33875 Change-Id: I0ed7c7ebc916fcad6da5e3c66d81be8f348a93e1 Reviewed-by: Jerome Pasion --- .../sensor_explorer/doc/src/sensor_explorer.qdoc | 71 +++++++++++++--------- 1 file changed, 42 insertions(+), 29 deletions(-) (limited to 'examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc') diff --git a/examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc b/examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc index be042156..b40bf39f 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} -*/ - -- cgit v1.2.3