1
/****************************************************************************
3
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4
** All rights reserved.
5
** Contact: Nokia Corporation (qt-info@nokia.com)
7
** This file is part of the documentation of the Qt Toolkit.
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
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.
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.
28
** If you have questions regarding the use of this file, please contact
29
** Nokia at qt-info@nokia.com.
40
****************************************************************************/
43
\headerfile <QtPlugin>
44
\title Macros for Defining Plugins
46
\brief The <QtPlugin> header files defines macros for defining plugins.
48
\sa {How to Create Qt Plugins}
52
\macro Q_DECLARE_INTERFACE(ClassName, Identifier)
55
This macro associates the given \a Identifier (a string literal)
56
to the interface class called \a ClassName. The \a Identifier must
57
be unique. For example:
59
\snippet examples/tools/plugandpaint/interfaces.h 3
61
This macro is normally used right after the class definition for
62
\a ClassName, in a header file. See the
63
\l{tools/plugandpaint}{Plug & Paint} example for details.
65
If you want to use Q_DECLARE_INTERFACE with interface classes
66
declared in a namespace then you have to make sure the Q_DECLARE_INTERFACE
67
is not inside a namespace though. For example:
68
\snippet doc/src/snippets/code/doc_src_qplugin.qdoc 0
70
\sa Q_INTERFACES(), Q_EXPORT_PLUGIN2(), {How to Create Qt Plugins}
74
\macro Q_EXPORT_PLUGIN(ClassName)
78
Use Q_EXPORT_PLUGIN2() instead. This macro is equivalent to
79
Q_EXPORT_PLUGIN2(\a ClassName, \a ClassName).
83
\macro Q_EXPORT_PLUGIN2(PluginName, ClassName)
86
\keyword Q_EXPORT_PLUGIN2
88
This macro exports the plugin class \a ClassName for the plugin specified
89
by \a PluginName. The value of \a PluginName should correspond to the
90
\l{qmake Variable Reference#TARGET}{TARGET} specified in the plugin's
93
There should be exactly one occurrence of this macro in the source code
94
for a Qt plugin, and it should be used where the implementation is written
95
rather than in a header file.
99
\snippet doc/src/snippets/code/doc_src_qplugin.qdoc 1
101
See the \l{tools/plugandpaint}{Plug & Paint} example for details.
103
\sa Q_DECLARE_INTERFACE(), {How to Create Qt Plugins}
107
\macro Q_IMPORT_PLUGIN(PluginName)
110
This macro imports the plugin named \a PluginName, corresponding
111
to the \l{qmake Variable Reference#TARGET}{TARGET} specified in the
112
plugin's project file.
114
Inserting this macro into your application's source code will allow
115
you to make use of a static plugin.
119
\snippet doc/src/snippets/code/doc_src_qplugin.qdoc 2
121
Static plugins must also be included by the linker when your
122
application is built. For Qt's predefined plugins,
123
you can use the \c QTPLUGIN to add
124
the required plugins to your build. For example:
126
\snippet doc/src/snippets/code/doc_src_qplugin.qdoc 3
128
\sa {Static Plugins}, {How to Create Qt Plugins}, {Using qmake}
132
\macro Q_EXPORT_STATIC_PLUGIN(ClassName)