summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/features/default_pre.prf5
-rw-r--r--mkspecs/features/qt.prf8
-rw-r--r--src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp17
-rw-r--r--src/corelib/doc/snippets/code/doc_src_plugins-howto.pro10
-rw-r--r--src/corelib/doc/src/plugins-howto.qdoc25
5 files changed, 33 insertions, 32 deletions
diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf
index 9268747978..b6019047d1 100644
--- a/mkspecs/features/default_pre.prf
+++ b/mkspecs/features/default_pre.prf
@@ -1,2 +1,5 @@
load(exclusive_builds)
-CONFIG = lex yacc warn_on debug exceptions testcase_targets depend_includepath $$CONFIG
+CONFIG = \
+ lex yacc warn_on debug exceptions depend_includepath \
+ testcase_targets import_plugins import_qpa_plugin \
+ $$CONFIG
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
index 30bbae7c64..7b41859d09 100644
--- a/mkspecs/features/qt.prf
+++ b/mkspecs/features/qt.prf
@@ -35,9 +35,11 @@ QT_PLUGIN_VERIFY = DEPLOYMENT_PLUGIN
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 = \
diff --git a/src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp b/src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp
index ca6e64a90e..a86441c822 100644
--- a/src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_plugins-howto.cpp
@@ -65,20 +65,3 @@ QStyle *MyStylePlugin::create(const QString &key)
//! [2]
QApplication::setStyle(QStyleFactory::create("MyStyle"));
//! [2]
-
-
-//! [4]
-#include <QApplication>
-#include <QtPlugin>
-
-Q_IMPORT_PLUGIN(qjpeg)
-Q_IMPORT_PLUGIN(qgif)
-Q_IMPORT_PLUGIN(qkrcodecs)
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- ...
- return app.exec();
-}
-//! [4]
diff --git a/src/corelib/doc/snippets/code/doc_src_plugins-howto.pro b/src/corelib/doc/snippets/code/doc_src_plugins-howto.pro
index 2b20811377..b33db7942f 100644
--- a/src/corelib/doc/snippets/code/doc_src_plugins-howto.pro
+++ b/src/corelib/doc/snippets/code/doc_src_plugins-howto.pro
@@ -43,7 +43,7 @@ CONFIG += release
#! [3]
#! [4]
-CONFIG += qpa_default_plugin import_plugins
+CONFIG += qpa_minimal_plugin
#! [4]
#! [5]
@@ -51,3 +51,11 @@ QTPLUGIN += qjpeg \
qgif \
qkrcodecs
#! [5]
+
+#! [6]
+CONFIG -= import_qpa_plugin
+#! [6]
+
+#! [7]
+CONFIG -= import_plugins
+#! [7]
diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc
index 37c1c13fea..d94bf2eadc 100644
--- a/src/corelib/doc/src/plugins-howto.qdoc
+++ b/src/corelib/doc/src/plugins-howto.qdoc
@@ -266,18 +266,22 @@
\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:
@@ -296,15 +300,16 @@
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