Fix QT_NO_PRINTER build on Mac

On Mac the QT_NO_PRINTER build was not implemented.

Task-number: QTBUG-33565
Change-Id: I118472f9400aa0a0d0e192ae39a11ea38a66f340
Reviewed-by: John Layt <jlayt@kde.org>
This commit is contained in:
Vitalii Shastun 2013-09-20 18:23:33 +03:00 committed by The Qt Project
parent 77dc33dcdb
commit 5889b239b1
6 changed files with 14 additions and 5 deletions

View File

@ -133,7 +133,7 @@ void QCocoaNativeInterface::beep()
QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
{
#ifndef QT_NO_WIDGETS
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER)
return new QCocoaPrinterSupport();
#else
qFatal("Printing is not supported when Qt is configured with -no-widgets");
@ -143,7 +143,7 @@ QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine)
{
#ifndef QT_NO_WIDGETS
#if !defined(QT_NO_WIDGETS) && !defined(QT_NO_PRINTER)
QMacPrintEnginePrivate *macPrintEnginePriv = static_cast<QMacPrintEngine *>(printEngine)->d_func();
if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized())
macPrintEnginePriv->initialize();

View File

@ -43,6 +43,7 @@
#define QCOCOAPRINTERSUPPORT_H
#include <qpa/qplatformprintersupport.h>
#ifndef QT_NO_PRINTER
#include "qt_mac_p.h"
@ -64,4 +65,5 @@ private:
QPrinterInfo printerInfoFromPMPrinter(const PMPrinter &printer);
};
#endif // QT_NO_PRINTER
#endif // QCOCOAPRINTERSUPPORT_H

View File

@ -40,6 +40,8 @@
****************************************************************************/
#include "qcocoaprintersupport.h"
#ifndef QT_NO_PRINTER
#include "qprintengine_mac_p.h"
#include <QtPrintSupport/QPrinter>
@ -169,3 +171,5 @@ QList<QPair<QString, QSizeF> > QCocoaPrinterSupport::supportedSizesWithNames(con
PMRelease(printer);
return returnValue;
}
#endif //QT_NO_PRINTER

View File

@ -117,8 +117,10 @@ static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransfor
QMacCGContext::QMacCGContext(QPainter *p)
{
QPaintEngine *pe = p->paintEngine();
#ifndef QT_NO_PRINTER
if (pe->type() == QPaintEngine::MacPrinter)
pe = static_cast<QMacPrintEngine*>(pe)->paintEngine();
#endif
pe->syncState();
context = 0;
if (pe->type() == QPaintEngine::CoreGraphics)

View File

@ -39,11 +39,12 @@
**
****************************************************************************/
#ifndef QT_NO_PRINTDIALOG
#include <Cocoa/Cocoa.h>
#include "qpagesetupdialog.h"
#ifndef QT_NO_PRINTDIALOG
#include "qpagesetupdialog_p.h"
#include <qpa/qplatformnativeinterface.h>

View File

@ -39,8 +39,6 @@
**
****************************************************************************/
#ifndef QT_NO_PRINTDIALOG
#include <Cocoa/Cocoa.h>
#include "qprintdialog.h"
@ -52,6 +50,8 @@
#include <QtPrintSupport/qprinter.h>
#include <QtPrintSupport/qprintengine.h>
#ifndef QT_NO_PRINTDIALOG
QT_BEGIN_NAMESPACE
class QPrintDialogPrivate : public QAbstractPrintDialogPrivate