Link printer plugins into user projects when using a static Qt

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ø <tor.arne.vestbo@qt.io>
bb10
Joerg Bornemann 2021-11-16 16:37:35 +01:00
parent a41d9bcac9
commit 68600869cd
3 changed files with 6 additions and 4 deletions

View File

@ -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))

View File

@ -128,8 +128,6 @@ QPlatformPrinterSupport *QCocoaPrinterSupportPlugin::create(const QString &key)
return new QCocoaPrinterSupport();
}
Q_IMPORT_PLUGIN(QCocoaPrinterSupportPlugin)
#include "qcocoaprintersupport.moc"
QT_END_NAMESPACE

View File

@ -103,8 +103,6 @@ QPlatformPrinterSupport *QWindowsPrinterSupportPlugin::create(const QString &key
return nullptr;
}
Q_IMPORT_PLUGIN(QWindowsPrinterSupportPlugin)
#include "qwindowsprintersupport.moc"
QT_END_NAMESPACE