diff --git a/configure b/configure index cebb5a8ea2c260f5d9015484010254c1795713a1..f2251be2339c00698f799e9a4d3e0375c12dc83b 100755 --- 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" diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 6b2833b09e80a0dcd958040f3234c25d7a2e1b3b..0735ec465cd0fa0e4cd24a3aacc620ecdbc05293 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -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" \ 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 20d5f7e41b9e52aaa1bf5d79a6c0286e314f7007..2b20811377ac9bea7d304c202f15a263c5e1a7b0 100644 --- a/src/corelib/doc/snippets/code/doc_src_plugins-howto.pro +++ b/src/corelib/doc/snippets/code/doc_src_plugins-howto.pro @@ -42,6 +42,9 @@ CONFIG += release #! [3] +#! [4] +CONFIG += qpa_default_plugin import_plugins +#! [4] #! [5] QTPLUGIN += qjpeg \ diff --git a/src/corelib/doc/src/plugins-howto.qdoc b/src/corelib/doc/src/plugins-howto.qdoc index 332b92596b500cc1d6834f0763ce592255712ef6..37c1c13fea42de083e059c0d521e0e20c9cba311 100644 --- a/src/corelib/doc/src/plugins-howto.qdoc +++ b/src/corelib/doc/src/plugins-howto.qdoc @@ -296,6 +296,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 + 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 diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 696d07ade48e70ef6c20d2aeb8f3e75b47e89371..2bb670dfd7267d2ae2c7f02e5987c09037a109bb 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -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(); }