The \c TEMPLATE variable's value makes \c qmake create the custom
widget as a library. Later, we will ensure that the widget will be
- recognized as a plugin by Qt by using the Q_EXPORT_PLUGIN2() macro
+ recognized as a plugin by Qt by using the Q_PLUGIN_METADATA() macro
to export the relevant widget information.
The \c CONFIG variable contains two values, \c designer and \c
\snippet containerextension/multipagewidgetplugin.cpp 14
- Remember to use the Q_EXPORT_PLUGIN2() macro to export the
+ Remember to use the Q_PLUGIN_METADATA() macro to export the
MultiPageWidgetPlugin class for use with Qt's plugin handling
classes: This macro ensures that \QD can access and construct the
custom widget. Without this macro, there is no way for \QD to use
The \c TEMPLATE variable's value makes \c qmake create the custom
widget as a library. Later, we will ensure that the widget will be
- recognized as a plugin by Qt by using the Q_EXPORT_PLUGIN2() macro
+ recognized as a plugin by Qt by using the Q_PLUGIN_METADATA() macro
to export the relevant widget information.
The \c CONFIG variable contains two values, \c designer and \c
alongside the other \QD plugins when the project is installed
(using \c{make install} or an equivalent installation procedure).
Later, we will ensure that it is recognized as a plugin by \QD by
- using the Q_EXPORT_PLUGIN2() macro to export the relevant widget
+ using the Q_PLUGIN_METADATA() macro to export the relevant widget
information.
Note that if you want the plugins to appear in a Visual Studio
The \c TEMPLATE variable's value makes \c qmake create the custom
widget as a library. Later, we will ensure that the widget will be
- recognized as a plugin by Qt by using the Q_EXPORT_PLUGIN2() macro to
+ recognized as a plugin by Qt by using the Q_PLUGIN_METADATA() macro to
export the relevant widget information.
The \c CONFIG variable contains two values, \c designer and \c
\snippet taskmenuextension/tictactoeplugin.cpp 4
- Finally, we use the Q_EXPORT_PLUGIN2() macro to export the
+ Finally, we use the Q_PLUGIN_METADATA() macro to export the
TicTacToePlugin class for use with Qt's plugin handling classes:
This macro ensures that \QD can access and construct the custom
widget. Without this macro, there is no way for \QD to use the
{customwidgetplugin}{Custom Widget Plugin} example (only
the class name and the implementation of
QDesignerCustomWidgetInterface::domXml() differ). The main thing
- to remember is to use the Q_EXPORT_PLUGIN2() macro to export the \c
+ to remember is to use the Q_PLUGIN_METADATA() macro to export the \c
WorldTimeClockPlugin class for use with \QD:
- \snippet worldtimeclockplugin/worldtimeclockplugin.cpp 0
+ \snippet worldtimeclockplugin/worldtimeclockplugin.h 1
Without this macro, there is no way for Qt Designer to use the
widget.
alongside the other \QD plugins when the project is installed
(using \c{make install} or an equivalent installation procedure).
Later, we will ensure that it is recognized as a plugin by \QD by
- using the Q_EXPORT_PLUGIN2() macro to export the relevant widget
+ using the Q_PLUGIN_METADATA() macro to export the relevant widget
information.
Note that if you want the plugins to appear in a Visual Studio
public QDesignerCustomWidgetInterface
{
Q_OBJECT
+//! [1]
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface" FILE "worldtimeclock.json")
+//! [1]
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
that they export the symbols needed by \QD.
First of all, the plugin class must be exported in order for the plugin to
- be loaded by \QD. Use the Q_EXPORT_PLUGIN2() macro to do this. Also, the
+ be loaded by \QD. Use the Q_PLUGIN_METADATA() macro to do this. Also, the
QDESIGNER_WIDGET_EXPORT macro must be used to define each custom widget class
within a plugin, that \QD will instantiate.