diff options
author | Lincoln Ramsay <lincoln.ramsay@nokia.com> | 2012-03-14 16:33:19 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-16 08:02:30 +0100 |
commit | 8d25a4a58c47431c589d8cbbc82e442360cf7e63 (patch) | |
tree | 14d4c0f123e602e8528298346f72df5debd2936c /doc/src | |
parent | b6d87d1b5141987452bc30e8b1d4115998ba6fd9 (diff) | |
download | qtsensors-8d25a4a58c47431c589d8cbbc82e442360cf7e63.tar.gz |
Use the new plugin mechanism for Sensors and SensorGestures
Plugins no longer use QFactoryInterface or Q_EXPORT_PLUGIN. Instead,
Q_PLUGIN_METADATA is used.
Meta-data is provided through a .json file that is embedded into the
plugin by moc.
For now, this meta-data is not actually used because both sensors
and gestures use a dynamic registration mechanism.
Change-Id: Ic82657e2ba5768127e13f7411ca51f60772781d8
Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/snippets/sensorgestures/myplugin.h | 6 | ||||
-rw-r--r-- | doc/src/snippets/sensorgestures/plugin.cpp | 3 | ||||
-rw-r--r-- | doc/src/snippets/sensors/plugin.cpp | 5 |
3 files changed, 5 insertions, 9 deletions
diff --git a/doc/src/snippets/sensorgestures/myplugin.h b/doc/src/snippets/sensorgestures/myplugin.h index e816534..ad3fba0 100644 --- a/doc/src/snippets/sensorgestures/myplugin.h +++ b/doc/src/snippets/sensorgestures/myplugin.h @@ -68,7 +68,9 @@ Q_SIGNALS: class MySensorGesturePlugin : public QObject, public QSensorGesturePluginInterface { Q_OBJECT - Q_INTERFACES(QSensorGesturePluginInterface:QFactoryInterface) + //Q_PLUGIN_METADATA(IID "com.Nokia.QSensorGesturePluginInterface" FILE "plugin.json") + Q_INTERFACES(QSensorGesturePluginInterface) +public: explicit MySensorGesturePlugin(); ~MySensorGesturePlugin(); @@ -78,6 +80,4 @@ class MySensorGesturePlugin : public QObject, public QSensorGesturePluginInterfa QString name() const { return "MyGestures"; } }; -//Q_EXPORT_PLUGIN2(MySensorGestureRecognizer, MySensorGesturePlugin) - #endif diff --git a/doc/src/snippets/sensorgestures/plugin.cpp b/doc/src/snippets/sensorgestures/plugin.cpp index 02b3dbd..35c21ba 100644 --- a/doc/src/snippets/sensorgestures/plugin.cpp +++ b/doc/src/snippets/sensorgestures/plugin.cpp @@ -98,6 +98,3 @@ QStringList MySensorGesturePlugin::supportedIds() const } //! [Plugin] - -//Q_EXPORT_PLUGIN2(libmy_plugin_file_name, MySensorGesturePlugin); -//#include "plugin.moc" diff --git a/doc/src/snippets/sensors/plugin.cpp b/doc/src/snippets/sensors/plugin.cpp index b75cd64..fb0708f 100644 --- a/doc/src/snippets/sensors/plugin.cpp +++ b/doc/src/snippets/sensors/plugin.cpp @@ -48,7 +48,8 @@ const char *MyBackend::id = "mybackend"; class MyPluginClass : public QObject, public QSensorPluginInterface, public QSensorBackendFactory { Q_OBJECT - Q_INTERFACES(QSensorPluginInterface:QFactoryInterface) + //Q_PLUGIN_METADATA(IID "com.nokia.Qt.QSensorPluginInterface/1.0" FILE "plugin.json") + Q_INTERFACES(QSensorPluginInterface) public: void registerSensors() { @@ -61,9 +62,7 @@ public: return new MyBackend(sensor); return 0; } - QStringList keys() const { return QStringList() << "myplugin";} }; //! [Plugin] -//Q_EXPORT_PLUGIN2(libmy_plugin_file_name, MyPluginClass); #include "plugin.moc" |