|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtDeclarative module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qdeclarativeextensionplugin.h" |
|
43 |
|
44 QT_BEGIN_NAMESPACE |
|
45 |
|
46 /*! |
|
47 \since 4.7 |
|
48 \class QDeclarativeExtensionPlugin |
|
49 \brief The QDeclarativeExtensionPlugin class provides an abstract base for custom QML extension plugins. |
|
50 |
|
51 \ingroup plugins |
|
52 |
|
53 QDeclarativeExtensionPlugin is a plugin interface that makes it |
|
54 possible to offer extensions that can be loaded dynamically into |
|
55 applications using the QDeclarativeEngine class. |
|
56 |
|
57 Writing a QML extension plugin is achieved by subclassing this |
|
58 base class, reimplementing the pure virtual registerTypes() |
|
59 function, and exporting the class using the Q_EXPORT_PLUGIN2() |
|
60 macro. |
|
61 |
|
62 QML extension plugins can be used to provide either application-specific or |
|
63 library-like plugins. Library plugins should limit themselves to registering types, |
|
64 as any manipulation of the engine's root context may cause conflicts |
|
65 or other issues in the library user's code. |
|
66 |
|
67 See \l {Tutorial: Writing QML extensions with C++} for details on creating |
|
68 QML extensions, including how to build a plugin with with QDeclarativeExtensionPlugin. |
|
69 For a simple overview, see the \l{declarative/cppextensions/plugins}{plugins} example. |
|
70 |
|
71 Also see \l {How to Create Qt Plugins} for general Qt plugin documentation. |
|
72 |
|
73 \sa QDeclarativeEngine::importPlugin() |
|
74 */ |
|
75 |
|
76 /*! |
|
77 \fn void QDeclarativeExtensionPlugin::registerTypes(const char *uri) |
|
78 |
|
79 Registers the QML types in the given \a uri. Subclasses should implement |
|
80 this to call qmlRegisterType() for all types which are provided by the extension |
|
81 plugin. |
|
82 |
|
83 The \a uri is an identifier for the plugin generated by the QML engine |
|
84 based on the name and path of the extension's plugin library. |
|
85 */ |
|
86 |
|
87 /*! |
|
88 Constructs a QML extension plugin with the given \a parent. |
|
89 |
|
90 Note that this constructor is invoked automatically by the |
|
91 Q_EXPORT_PLUGIN2() macro, so there is no need for calling it |
|
92 explicitly. |
|
93 */ |
|
94 QDeclarativeExtensionPlugin::QDeclarativeExtensionPlugin(QObject *parent) |
|
95 : QObject(parent) |
|
96 { |
|
97 } |
|
98 |
|
99 /*! |
|
100 Destroys the plugin. |
|
101 */ |
|
102 QDeclarativeExtensionPlugin::~QDeclarativeExtensionPlugin() |
|
103 { |
|
104 } |
|
105 |
|
106 /*! |
|
107 \fn void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) |
|
108 |
|
109 Initializes the extension from the \a uri using the \a engine. Here an application |
|
110 plugin might, for example, expose some data or objects to QML, |
|
111 as context properties on the engine's root context. |
|
112 */ |
|
113 |
|
114 void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) |
|
115 { |
|
116 Q_UNUSED(engine); |
|
117 Q_UNUSED(uri); |
|
118 } |
|
119 |
|
120 QT_END_NAMESPACE |