diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-08-05 10:47:38 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-08-07 08:02:08 +0000 |
commit | 98ff203205ec77a3f4afbbe0ca3e34afb90274bd (patch) | |
tree | b62bbf26b8df072722e757f6c4ae6b8fe02bb3b9 /src | |
parent | 372804f1f64918e281a29cd2f849f7e1b1488eee (diff) |
Make QQmlExtensionPlugin documentation clearer.
I spent too long wondering why my plugin wasn't being loaded, until I
realized that the directory I was installing the qmldir into was not
named the same as the module. This is already documented in the
"Module Definition qmldir Files" documentation:
http://doc.qt.io/qt-5/qtqml-modules-qmldir.html#contents-of-a-module-definition-qmldir-file
But as I was writing a plugin, I was following this documentation:
http://doc.qt.io/qt-5/qtqml-modules-cppplugins.html
Where it was not at all obvious that they should be named the same.
Change-Id: I3e20bc31f8b42c7141b4c22c8cb1750ba9782971
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc b/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc index 2274617f77..7c1d65b095 100644 --- a/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc +++ b/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc @@ -47,12 +47,7 @@ imported correctly by any QML components that use this plugin. The \l{Defining QML Types from C++} article has more information about registering C++ types into the runtime. -For this example, the TimeExample source directory is in -\c{imports/TimeExample}. The plugin's type namespace will mirror -this structure, so the types are registered into the namespace -"TimeExample". - -Additionally, the project file, in a \c .pro file, defines the project as a plugin library, +Additionally, the project file (\c .pro) defines the project as a plugin library, specifies it should be built into the \c imports/TimeExample directory, and registers the plugin target name and various other details: @@ -74,6 +69,18 @@ need to be specified in the \c qmldir file: \quotefile qmlextensionplugins/imports/TimeExample/qmldir +To make things easier for this example, the TimeExample source directory is in +\c{imports/TimeExample}, and we build +\l{Source, Build, and Install Directories}{in-source}. However, the structure +of the source directory is not so important, as the \c qmldir file can specify +paths to installed QML files. + +What is important is the name of the directory that the qmldir is installed +into. When the user imports our module, the QML engine uses the +\l{Contents of a Module Definition qmldir File}{module identifier} +(\c TimeExample) to find the plugin, and so the directory in which it is +installed must match the module identifier. + Once the project is built and installed, the new \c Time component is accessible by any QML component that imports the \c TimeExample module |