diff options
Diffstat (limited to 'src/qml/qml/qqmlextensionplugin.cpp')
-rw-r--r-- | src/qml/qml/qqmlextensionplugin.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index edef5a91cd..f77b176404 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -54,10 +54,10 @@ QT_BEGIN_NAMESPACE QQmlExtensionPlugin is a plugin interface that makes it possible to create QML extensions that can be loaded dynamically into QML applications. - These extensions allow custom QML types to be made available to the QML engine. - + These extensions allow custom QML types to be made available to the QML engine. + To write a QML extension plugin: - + \list \li Subclass QQmlExtensionPlugin, implement registerTypes() method to register types using qmlRegisterType(), and export the class using the Q_PLUGIN_METADATA() macro @@ -74,10 +74,10 @@ QT_BEGIN_NAMESPACE \section1 An example Suppose there is a new \c TimeModel C++ class that should be made available - as a new QML element. It provides the current time through \c hour and \c minute + as a new QML element. It provides the current time through \c hour and \c minute properties, like this: - \snippet qml/plugins/plugin.cpp 0 + \snippet plugins/plugin.cpp 0 \dots To make this class available as a QML type, create a plugin that registers @@ -85,13 +85,13 @@ QT_BEGIN_NAMESPACE module will be named \c TimeExample (as defined in the project file further below). - \snippet qml/plugins/plugin.cpp plugin + \snippet plugins/plugin.cpp plugin - This registers the \c TimeModel class with the 1.0 version of this - plugin library, as a QML type called \c Time. The Q_ASSERT statement + This registers the \c TimeModel class with the 1.0 version of this + plugin library, as a QML type called \c Time. The Q_ASSERT statement ensures the module is imported correctly by any QML components that use this plugin. - The project file defines the project as a plugin library and specifies + The project file defines the project as a plugin library and specifies it should be built into the \c imports/TimeExample directory: \code @@ -102,26 +102,26 @@ QT_BEGIN_NAMESPACE DESTDIR = imports/TimeExample TARGET = qmlqtimeexampleplugin ... - \endcode + \endcode Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c imports/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 qml/plugins/imports/TimeExample/qmldir + \quotefile plugins/imports/TimeExample/qmldir - Once the project is built and installed, the new \c Time element can be + Once the project is built and installed, the new \c Time element can be used by any QML component that imports the \c TimeExample module: - \snippet qml/plugins/plugins.qml 0 + \snippet plugins/plugins.qml 0 The full source code is available in the \l {qml/plugins}{plugins example}. 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. + Note that the \l {Qt Quick 1} version is called QDeclarativeExtensionPlugin. \sa QQmlEngine::importPlugin(), {How to Create Qt Plugins} */ @@ -134,7 +134,7 @@ QT_BEGIN_NAMESPACE plugin. The \a uri is an identifier for the plugin generated by the QML engine - based on the name and path of the extension's plugin library. + based on the name and path of the extension's plugin library. */ /*! |