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 dde9569d38)
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
bb10
Andy Shaw 2012-12-17 22:46:45 +01:00 committed by The Qt Project
parent bb454255a3
commit 3a75e2f227
1 changed files with 4 additions and 2 deletions

View File

@ -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;