\li Subclass QQmlExtensionPlugin, implement registerTypes() method
to register types using qmlRegisterType(), and export the class using the Q_EXPORT_PLUGIN2() macro
\li Write an appropriate project file for the plugin
- \li Create a \l{Writing a qmldir file}{qmldir file} to describe the plugin
+ \li Create a \l{Module Definition qmldir Files}{qmldir file} to describe the plugin
\endlist
QML extension plugins can be used to provide either application-specific or
...
\endcode
- Finally, a \l{Writing a qmldir file}{qmldir file} is required in the \c com/nokia/TimeExample directory
+ Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c com/nokia/TimeExample directory
that describes the plugin. This directory includes a \c Clock.qml file that
should be bundled with the plugin, so it needs to be specified in the \c qmldir
file:
- \quotefile examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir
+ \quotefile examples/qml/cppextensions/plugins/com/nokia/TimeExample/qmldir
Once the project is built and installed, the new \c Time element can be
used by any QML component that imports the \c com.nokia.TimeExample module:
- \snippet examples/declarative/cppextensions/plugins/plugins.qml 0
+ \snippet examples/qml/cppextensions/plugins/plugins.qml 0
- The full source code is available in the \l {declarative/cppextensions/plugins}{plugins example}.
+ The full source code is available in the \l {qml/cppextensions/plugins}{plugins example}.
- The \l {Tutorial: Writing QML extensions with C++} also contains a chapter
+ The \l {Writing QML Extensions with C++} tutorial also contains a chapter
on creating QML plugins.
Note that the QtQuick 1 version is called QDeclarativeExtensionPlugin.