contains(QT_CONFIG, static) {
QT_PLUGIN_VERIFY += QTPLUGIN
contains(TEMPLATE, .*app) {
- contains(QT, gui) {
- qpa_minimal_plugin: QTPLUGIN += qminimal
- qpa_default_plugin: QTPLUGIN += $$QT_DEFAULT_QPA_PLUGIN
+ contains(QT, gui):import_qpa_plugin {
+ qpa_minimal_plugin: \
+ QTPLUGIN += qminimal
+ else: \
+ QTPLUGIN += $$QT_DEFAULT_QPA_PLUGIN
}
import_plugins:!isEmpty(QTPLUGIN) {
IMPORT_FILE_CONT = \
\row \li \c qsqltds \li SQL driver \li Sybase Adaptive Server (TDS)
\endtable
- To link statically against those plugins, you need to use the
- Q_IMPORT_PLUGIN() macro in your application and you need to add
+ To link statically against those plugins, you need to add
the required plugins to your build using \c QTPLUGIN.
- For example, in your \c main.cpp:
-
- \snippet code/doc_src_plugins-howto.cpp 4
+ Q_IMPORT_PLUGIN() macros are also needed in application code,
+ but those are automatically generated by qmake and added to
+ your application project.
In the \c .pro file for your application, you need the following
entry:
\snippet code/doc_src_plugins-howto.pro 5
+ If you do not want all plugins added to QTPLUGIN to be automatically
+ linked, remove \c import_plugins from the \c CONFIG variable:
+
+ \snippet code/doc_src_plugins-howto.pro 7
+
It is also possible to create your own static plugins, by
following these steps:
to make sure that the \c{QT_STATICPLUGIN} preprocessor macro is
defined.
- Qt platform adaptation plugins are not automatically linked in static
- builds. To add default QPA plugin to \c QTPLUGIN variable and automatically
- generate Q_IMPORT_PLUGIN statements for your application, add the following
+ The default Qt platform adaptation plugin is automatically added to QTPLUGIN
+ in static builds. If you want to add the minimal plugin instead, add \c qpa_minimal_plugin
to \c CONFIG:
\snippet code/doc_src_plugins-howto.pro 4
- If the minimal QPA plugin is required, use \c qpa_minimal_plugin instead of
- \c qpa_default_plugin.
+ If you want neither the default nor the minimal QPA plugin to be linked automatically,
+ remove \c import_qpa_plugin from \c CONFIG:
+
+ \snippet code/doc_src_plugins-howto.pro 6
\section1 Deploying and Debugging Plugins