From 68600869cd3a1b5f118d9a69200f1a6453e0c8ec Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 16 Nov 2021 16:37:35 +0100 Subject: [PATCH] Link printer plugins into user projects when using a static Qt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building a user project against a static Qt on Windows or macOS the static printer support plugins were not linked. Move the Q_IMPORT_PLUGIN statements to qplatformprintplugin.cpp, which is a translation unit that is guaranteed to be linked into the user project. Pick-to: 6.2 Fixes: QTBUG-97490 Change-Id: Ic35c6483a664a06461304c7e8a2b7b06ce651ed6 Reviewed-by: Tor Arne Vestbø --- src/printsupport/kernel/qplatformprintplugin.cpp | 6 ++++++ src/printsupport/platform/macos/qcocoaprintersupport.mm | 2 -- .../platform/windows/qwindowsprintersupport.cpp | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/printsupport/kernel/qplatformprintplugin.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp index 9a7656f7d6..6f470b835c 100644 --- a/src/printsupport/kernel/qplatformprintplugin.cpp +++ b/src/printsupport/kernel/qplatformprintplugin.cpp @@ -48,6 +48,12 @@ QT_BEGIN_NAMESPACE +#if defined(Q_OS_MACOS) +Q_IMPORT_PLUGIN(QCocoaPrinterSupportPlugin) +#elif defined(Q_OS_WIN) +Q_IMPORT_PLUGIN(QWindowsPrinterSupportPlugin) +#endif + Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QPlatformPrinterSupportFactoryInterface_iid, QLatin1String("/printsupport"), Qt::CaseInsensitive)) diff --git a/src/printsupport/platform/macos/qcocoaprintersupport.mm b/src/printsupport/platform/macos/qcocoaprintersupport.mm index 64a63241e7..a9c536964d 100644 --- a/src/printsupport/platform/macos/qcocoaprintersupport.mm +++ b/src/printsupport/platform/macos/qcocoaprintersupport.mm @@ -128,8 +128,6 @@ QPlatformPrinterSupport *QCocoaPrinterSupportPlugin::create(const QString &key) return new QCocoaPrinterSupport(); } -Q_IMPORT_PLUGIN(QCocoaPrinterSupportPlugin) - #include "qcocoaprintersupport.moc" QT_END_NAMESPACE diff --git a/src/printsupport/platform/windows/qwindowsprintersupport.cpp b/src/printsupport/platform/windows/qwindowsprintersupport.cpp index fbf11fe93e..8d8322dca9 100644 --- a/src/printsupport/platform/windows/qwindowsprintersupport.cpp +++ b/src/printsupport/platform/windows/qwindowsprintersupport.cpp @@ -103,8 +103,6 @@ QPlatformPrinterSupport *QWindowsPrinterSupportPlugin::create(const QString &key return nullptr; } -Q_IMPORT_PLUGIN(QWindowsPrinterSupportPlugin) - #include "qwindowsprintersupport.moc" QT_END_NAMESPACE