Add QT_DEFAULT_QPA_PLUGIN to generated qconfig.pri
authorMiikka Heikkinen <miikka.heikkinen@digia.com>
Mon, 10 Dec 2012 14:11:47 +0000 (16:11 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 10 Dec 2012 14:33:54 +0000 (15:33 +0100)
Configure will now generate QT_DEFAULT_QPA_PLUGIN qmake variable
to specify the default QPA plugin.

"CONFIG += qpa_default_plugin" statement in application .pro file
will add the default QPA plugin into QTPLUGINS.

"CONFIG += qpa_minimal_plugin" statement in application .pro file
will add the minimal QPA plugin into QTPLUGINS.

Task-number: QTBUG-28131
Change-Id: I12a241005f30b37467d783b50f0369b47e605e68
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
configure
mkspecs/features/qt.prf
src/corelib/doc/snippets/code/doc_src_plugins-howto.pro
src/corelib/doc/src/plugins-howto.qdoc
tools/configure/configureapp.cpp

index cebb5a8..f2251be 100755 (executable)
--- a/configure
+++ b/configure
@@ -6026,6 +6026,11 @@ QT_NAMESPACE = $QT_NAMESPACE
 
 EOF
 
+if [ "$CFG_SHARED" = "no" ]; then
+    echo "QT_DEFAULT_QPA_PLUGIN = $QT_QPA_DEFAULT_PLATFORM" >> "$QTCONFIG.tmp"
+    echo >> "$QTCONFIG.tmp"
+fi
+
 if [ -n "$PKG_CONFIG_SYSROOT_DIR" ] || [ -n "$PKG_CONFIG_LIBDIR" ]; then
     echo "# pkgconfig" >> "$QTCONFIG.tmp"
     echo "PKG_CONFIG_SYSROOT_DIR = $PKG_CONFIG_SYSROOT_DIR" >> "$QTCONFIG.tmp"
index 6b2833b..0735ec4 100644 (file)
@@ -40,6 +40,10 @@ 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
+        }
         import_plugins:!isEmpty(QTPLUGIN) {
             IMPORT_FILE_CONT = \
                 "// This file is autogenerated by qmake. It imports static plugin classes for" \
index 20d5f7e..2b20811 100644 (file)
@@ -42,6 +42,9 @@
 CONFIG += release
 #! [3]
 
+#! [4]
+CONFIG += qpa_default_plugin import_plugins
+#! [4]
 
 #! [5]
 QTPLUGIN     += qjpeg \
index 332b925..37c1c13 100644 (file)
     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
+    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.
+
     \section1 Deploying and Debugging Plugins
 
     The \l{Deploying Plugins} document covers the process of deploying
index 696d07a..2bb670d 100644 (file)
@@ -3099,6 +3099,9 @@ void Configure::generateQConfigPri()
         if (!dictionary["QT_NAMESPACE"].isEmpty())
             configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
 
+        if (dictionary[ "SHARED" ] == "no")
+            configStream << "QT_DEFAULT_QPA_PLUGIN = " << qpaPlatformName() << endl;
+
         configStream.flush();
         configFile.close();
     }