From bd062a4532cb9ffc3539093da0adf3be6fdc8fc9 Mon Sep 17 00:00:00 2001 From: mae Date: Wed, 14 Apr 2010 16:55:36 +0200 Subject: Updates to the module documentation --- doc/src/declarative/qtdeclarative.qdoc | 7 +++++++ src/declarative/qml/qdeclarativeengine.cpp | 2 ++ src/declarative/qml/qdeclarativeextensionplugin.cpp | 12 ++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 8013b92..cbb2146 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -69,6 +69,10 @@ /*! \macro QML_DECLARE_TYPE() \relates QDeclarativeEngine + + Declares a C++ type to be usable in the QML system. In addition + to this, a type must also be registered with the QML system using + qmlRegisterType(). */ @@ -79,6 +83,7 @@ This template function registers the C++ type in the QML system with the name \a qmlName. in the library imported from \a uri having the version number composed from \a versionMajor and \a versionMinor. + The type should also haved been declared with the QML_DECLARE_TYPE() macro. Returns the QML type id. @@ -109,6 +114,8 @@ This template function registers the C++ type in the QML system under the name \a typeName. + The type should also haved been declared with the QML_DECLARE_TYPE() macro. + Returns the QML type id. */ diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index f621af5..c5afe92 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1949,6 +1949,8 @@ void QDeclarativeEngine::setPluginPathList(const QStringList &paths) /*! Imports the plugin named \a filePath with the \a uri provided. Returns true if the plugin was successfully imported; otherwise returns false. + + The plugin has to be a Qt plugin which implements the QDeclarativeExtensionPlugin interface. */ bool QDeclarativeEngine::importPlugin(const QString &filePath, const QString &uri, QString *errorString) { diff --git a/src/declarative/qml/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp index 5b7f1e8..762c642d 100644 --- a/src/declarative/qml/qdeclarativeextensionplugin.cpp +++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp @@ -55,17 +55,21 @@ QT_BEGIN_NAMESPACE applications using the QDeclarativeEngine class. Writing a QML extension plugin is achieved by subclassing this - base class, reimplementing the pure virtual initialize() + base class, reimplementing the pure virtual registerTypes() function, and exporting the class using the Q_EXPORT_PLUGIN2() - macro. See \l {How to Create Qt Plugins} for details. + macro. - \sa QDeclarativeEngine::importExtension() + See \l {Extending QML in C++} for details how to write a QML extension plugin. + See \l {How to Create Qt Plugins} for general Qt plugin documentation. + + \sa QDeclarativeEngine::importPlugin() */ /*! \fn void QDeclarativeExtensionPlugin::registerTypes(const char *uri) - Registers the QML types in the given \a uri. + Registers the QML types in the given \a uri. Here you call qmlRegisterType() for + all types which are provided by the extension plugin. */ /*! -- cgit v0.12