summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2012-12-17 22:46:45 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-18 07:21:19 +0100
commit3a75e2f227810d75adc22d426fcab1355611adee (patch)
treec6c96ac2f0ce673587f22b209b21b0c0535d0673 /src/plugins/platforms
parentbb454255a3a25290a88891ea00f6570b0ee13b96 (diff)
Initalize the printinfo on Mac if it requests and it needs initalizing
When the print panel was closed then it would clean up the printinfo and if it was requested for the same QPrinter then it would not be recreated in time. Therefore we check if it is initalized and if not we re-initalize it. Task-number: QTBUG-28657 Change-Id: I7dc9011b80e03cfa3eae8fee2fcf6cc8021a8566 Reviewed-by: Lars Knoll <lars.knoll@digia.com> (cherry picked from commit dde9569d389b4382e8869ac48f942adb3c51ade7) Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index f0b1bd330a..271c9d2894 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -107,8 +107,10 @@ QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine)
{
#ifndef QT_NO_WIDGETS
- QMacPrintEngine *macPrintEngine = static_cast<QMacPrintEngine *>(printEngine);
- return macPrintEngine->d_func()->printInfo;
+ QMacPrintEnginePrivate *macPrintEnginePriv = static_cast<QMacPrintEngine *>(printEngine)->d_func();
+ if (macPrintEnginePriv->state == QPrinter::Idle && !macPrintEnginePriv->isPrintSessionInitialized())
+ macPrintEnginePriv->initialize();
+ return macPrintEnginePriv->printInfo;
#else
qFatal("Printing is not supported when Qt is configured with -no-widgets");
return 0;