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) { qtHaveModule(widgets) {
QT_FOR_CONFIG += widgets QT_FOR_CONFIG += widgets
SOURCES += \ SOURCES += qpaintengine_mac.mm
qpaintengine_mac.mm \ HEADERS += qpaintengine_mac_p.h
qprintengine_mac.mm \
qcocoaprintersupport.mm \
qcocoaprintdevice.mm \
HEADERS += \ qtHaveModule(printsupport) {
qpaintengine_mac_p.h \ QT += printsupport-private
qprintengine_mac_p.h \ SOURCES += \
qcocoaprintersupport.h \ qprintengine_mac.mm \
qcocoaprintdevice.h \ qcocoaprintersupport.mm \
qcocoaprintdevice.mm
HEADERS += \
qcocoaprintersupport.h \
qcocoaprintdevice.h \
qprintengine_mac_p.h
}
qtConfig(colordialog) { qtConfig(colordialog) {
SOURCES += qcocoacolordialoghelper.mm SOURCES += qcocoacolordialoghelper.mm
@ -130,7 +133,7 @@ qtHaveModule(widgets) {
HEADERS += qcocoafontdialoghelper.h HEADERS += qcocoafontdialoghelper.h
} }
QT += widgets-private printsupport-private QT += widgets-private
} }
OTHER_FILES += cocoa.json OTHER_FILES += cocoa.json

View File

@ -59,7 +59,7 @@
#include "qguiapplication.h" #include "qguiapplication.h"
#include <qdebug.h> #include <qdebug.h>
#ifndef QT_NO_WIDGETS #if !defined(QT_NO_WIDGETS) && defined(QT_PRINTSUPPORT_LIB)
#include "qcocoaprintersupport.h" #include "qcocoaprintersupport.h"
#include "qprintengine_mac_p.h" #include "qprintengine_mac_p.h"
#include <qpa/qplatformprintersupport.h> #include <qpa/qplatformprintersupport.h>
@ -153,24 +153,24 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter
QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport() 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(); return new QCocoaPrinterSupport();
#else #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; return nullptr;
#endif #endif
} }
void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine) 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(); QMacPrintEnginePrivate *macPrintEnginePriv = static_cast<QMacPrintEngine *>(printEngine)->d_func();
if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized()) if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized())
macPrintEnginePriv->initialize(); macPrintEnginePriv->initialize();
return macPrintEnginePriv->printInfo; return macPrintEnginePriv->printInfo;
#else #else
Q_UNUSED(printEngine); 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; return nullptr;
#endif #endif
} }

View File

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