Cocoa: Compile when configured with -no-widgets

Build printing only if Qt is configured with
widget support.

This is mostly useful for testing -no-widgets builds.

Change-Id: I2d47b420e311869e85508db1f7372fe326617dec
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
Morten Johan Sorvig 2012-06-08 13:12:59 +02:00 committed by Qt by Nokia
parent f100f84703
commit 3abf49cdc8
3 changed files with 31 additions and 9 deletions

View File

@ -34,9 +34,6 @@ OBJECTIVE_SOURCES += main.mm \
qmacmime.mm \
qcocoasystemsettings.mm \
qcocoainputcontext.mm \
qpaintengine_mac.mm \
qprintengine_mac.mm \
qcocoaprintersupport.mm \
qcocoaservices.mm \
HEADERS += qcocoaintegration.h \
@ -69,16 +66,27 @@ HEADERS += qcocoaintegration.h \
qmacmime.h \
qcocoasystemsettings.h \
qcocoainputcontext.h \
qpaintengine_mac_p.h \
qprintengine_mac_p.h \
qcocoaprintersupport.h \
qcocoaservices.h \
RESOURCES += qcocoaresources.qrc
LIBS += -framework Cocoa -framework IOKit
QT += core-private gui-private widgets-private platformsupport-private printsupport-private
QT += core-private gui-private platformsupport-private
!contains(QT_CONFIG, no-widgets) {
OBJECTIVE_SOURCES += \
qpaintengine_mac.mm \
qprintengine_mac.mm \
qcocoaprintersupport.mm \
HEADERS += \
qpaintengine_mac_p.h \
qprintengine_mac_p.h \
qcocoaprintersupport.h \
QT += widgets-private printsupport-private
}
OTHER_FILES += cocoa.json
target.path += $$[QT_INSTALL_PLUGINS]/platforms

View File

@ -43,11 +43,12 @@
#define QCOCOANATIVEINTERFACE_H
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformprintersupport.h>
QT_BEGIN_NAMESPACE
class QWidget;
class QPlatformPrinterSupport;
class QPrintEngine;
class QCocoaNativeInterface : public QPlatformNativeInterface
{

View File

@ -42,7 +42,6 @@
#include "qcocoanativeinterface.h"
#include "qcocoaglcontext.h"
#include "qcocoawindow.h"
#include "qcocoaprintersupport.h"
#include "qcocoamenubar.h"
#include <qbytearray.h>
@ -54,7 +53,11 @@
#include "qguiapplication.h"
#include <qdebug.h>
#ifndef QT_NO_WIDGETS
#include "qcocoaprintersupport.h"
#include "qprintengine_mac_p.h"
#include <qpa/qplatformprintersupport.h>
#endif
QT_BEGIN_NAMESPACE
@ -81,13 +84,23 @@ void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceS
QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
{
#ifndef QT_NO_WIDGETS
return new QCocoaPrinterSupport();
#else
qFatal("Printing is not supported when Qt is configured with -no-widgets");
return 0;
#endif
}
void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine)
{
#ifndef QT_NO_WIDGETS
QMacPrintEngine *macPrintEngine = static_cast<QMacPrintEngine *>(printEngine);
return macPrintEngine->d_func()->printInfo;
#else
qFatal("Printing is not supported when Qt is configured with -no-widgets");
return 0;
#endif
}
void QCocoaNativeInterface::onAppFocusWindowChanged(QWindow *window)