Fix build with -no-feature-printer on macOS

Fixes: QTBUG-62675
Change-Id: I3bfcd6d78c3124769ff8662941472333c795fdbe
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
André Klitzing 2019-07-23 12:44:45 +02:00
parent c47f436175
commit b1db1dd655
3 changed files with 23 additions and 16 deletions

View File

@ -103,17 +103,20 @@ CONFIG += no_app_extension_api_only
qtHaveModule(widgets) {
QT_FOR_CONFIG += widgets
SOURCES += \
qpaintengine_mac.mm \
qprintengine_mac.mm \
qcocoaprintersupport.mm \
qcocoaprintdevice.mm \
SOURCES += qpaintengine_mac.mm
HEADERS += qpaintengine_mac_p.h
HEADERS += \
qpaintengine_mac_p.h \
qprintengine_mac_p.h \
qcocoaprintersupport.h \
qcocoaprintdevice.h \
qtHaveModule(printsupport) {
QT += printsupport-private
SOURCES += \
qprintengine_mac.mm \
qcocoaprintersupport.mm \
qcocoaprintdevice.mm
HEADERS += \
qcocoaprintersupport.h \
qcocoaprintdevice.h \
qprintengine_mac_p.h
}
qtConfig(colordialog) {
SOURCES += qcocoacolordialoghelper.mm
@ -130,7 +133,7 @@ qtHaveModule(widgets) {
HEADERS += qcocoafontdialoghelper.h
}
QT += widgets-private printsupport-private
QT += widgets-private
}
OTHER_FILES += cocoa.json

View File

@ -59,7 +59,7 @@
#include "qguiapplication.h"
#include <qdebug.h>
#ifndef QT_NO_WIDGETS
#if !defined(QT_NO_WIDGETS) && defined(QT_PRINTSUPPORT_LIB)
#include "qcocoaprintersupport.h"
#include "qprintengine_mac_p.h"
#include <qpa/qplatformprintersupport.h>
@ -153,24 +153,24 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter
QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
{
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER)
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER) && defined(QT_PRINTSUPPORT_LIB)
return new QCocoaPrinterSupport();
#else
qFatal("Printing is not supported when Qt is configured with -no-widgets");
qFatal("Printing is not supported when Qt is configured with -no-widgets or -no-feature-printer");
return nullptr;
#endif
}
void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine)
{
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER)
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER) && defined(QT_PRINTSUPPORT_LIB)
QMacPrintEnginePrivate *macPrintEnginePriv = static_cast<QMacPrintEngine *>(printEngine)->d_func();
if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized())
macPrintEnginePriv->initialize();
return macPrintEnginePriv->printInfo;
#else
Q_UNUSED(printEngine);
qFatal("Printing is not supported when Qt is configured with -no-widgets");
qFatal("Printing is not supported when Qt is configured with -no-widgets or -no-feature-printer");
return nullptr;
#endif
}

View File

@ -38,14 +38,18 @@
****************************************************************************/
#include "qpaintengine_mac_p.h"
#if defined(QT_PRINTSUPPORT_LIB)
#include "qprintengine_mac_p.h"
#endif
#include <qbitmap.h>
#include <qpaintdevice.h>
#include <qpainterpath.h>
#include <qpixmapcache.h>
#include <private/qpaintengine_raster_p.h>
#if defined(QT_PRINTSUPPORT_LIB)
#include <qprinter.h>
#endif
#include <qstack.h>
#include <qwidget.h>
#include <qvarlengtharray.h>