Add method to get NSPrintInfo* from QPrintEngine in Cocoa plugin

Add an invokable method that takes the QPrintEngine (which will
always be a QMacPrintEngine) and return the NSPrintInfo* from the
QMacPrintEnginePrivate. This will be used by the native dialogs in
QtPrintSupport to get/set printer settings.

Change-Id: If1e49027e8f0d505656db51be1f40a23f60e8e57
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
Bradley T. Hughes 2012-03-05 14:42:53 +01:00 committed by Qt by Nokia
parent 7dde92d7d1
commit 86fc4aa2b6
3 changed files with 16 additions and 0 deletions

View File

@ -66,6 +66,11 @@ private:
plugin.
*/
Q_INVOKABLE QPlatformPrinterSupport *createPlatformPrinterSupport();
/*
Function to return the NSPrintInfo * from QMacPaintEnginePrivate.
Needed by the native print dialog in the QtPrintSupport library.
*/
Q_INVOKABLE void *NSPrintInfoForPrintEngine(QPrintEngine *printEngine);
};
#endif // QCOCOANATIVEINTERFACE_H

View File

@ -52,6 +52,8 @@
#include "qopenglcontext.h"
#include <qdebug.h>
#include "qprintengine_mac_p.h"
void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
{
if (!window->handle()) {
@ -73,3 +75,9 @@ QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
{
return new QCocoaPrinterSupport();
}
void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine)
{
QMacPrintEngine *macPrintEngine = static_cast<QMacPrintEngine *>(printEngine);
return macPrintEngine->d_func()->printInfo;
}

View File

@ -108,6 +108,9 @@ public:
virtual void drawTextItem(const QPointF &p, const QTextItem &ti);
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
virtual void drawPath(const QPainterPath &);
private:
friend class QCocoaNativeInterface;
};
class QMacPrintEnginePrivate : public QPaintEnginePrivate