From 98a5e032e94ba77bb67a615e2042462b5e6f2923 Mon Sep 17 00:00:00 2001 From: Lincoln Ramsay Date: Mon, 8 Mar 2010 13:42:18 +1000 Subject: replace \code blocks with \snippet statements. This will let the compiler notify us when our example snippets are no longer valid. --- doc/src/snippets/sensors/plugin.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 doc/src/snippets/sensors/plugin.cpp (limited to 'doc/src/snippets/sensors/plugin.cpp') diff --git a/doc/src/snippets/sensors/plugin.cpp b/doc/src/snippets/sensors/plugin.cpp new file mode 100644 index 0000000000..a4855659ca --- /dev/null +++ b/doc/src/snippets/sensors/plugin.cpp @@ -0,0 +1,28 @@ +#include "mybackend.h" +#include +#include + +const char *MyBackend::id = "mybackend"; + +//! [Plugin] +class MyPluginClass : public QObject, QSensorPluginInterface, public QSensorBackendFactory +{ + Q_OBJECT + Q_INTERFACES(QtMobility::QSensorPluginInterface) +public: + void registerSensors() + { + QSensorManager::registerBackend(QAccelerometer::type, MyBackend::id, this); + } + + QSensorBackend *createBackend(QSensor *sensor) + { + if (sensor->identifier() == MyBackend::id) + return new MyBackend(sensor); + return 0; + } +}; +//! [Plugin] + +//Q_EXPORT_PLUGIN2(libmy_plugin_file_name, MyPluginClass); +#include "plugin.moc" -- cgit v1.2.3