From 4e4b2d67010f1fc90a0227c36adab56a3e1ce679 Mon Sep 17 00:00:00 2001 From: John Layt Date: Wed, 16 Apr 2014 15:47:14 +0100 Subject: QPrintDialog - Fix mac change of printer name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the user changes the printer name in the Mac print dialog then update the print device in QPrint to reflect this. Task-number: QTBUG-37808 Change-Id: I3aaf27e2db7277ab083dc8f8d59f0f80ecd424f1 Reviewed-by: Morten Johan Sørvig --- src/printsupport/dialogs/qprintdialog_mac.mm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm index 9ff7c4766a..33a11cc079 100644 --- a/src/printsupport/dialogs/qprintdialog_mac.mm +++ b/src/printsupport/dialogs/qprintdialog_mac.mm @@ -143,11 +143,11 @@ QT_USE_NAMESPACE CFURLGetFileSystemRepresentation(file, true, localFile, sizeof(localFile)); printer->setOutputFileName(QString::fromUtf8(reinterpret_cast(localFile))); } else { - // Keep output format. - QPrinter::OutputFormat format; - format = printer->outputFormat(); - printer->setOutputFileName(QString()); - printer->setOutputFormat(format); + PMPrinter macPrinter; + PMSessionGetCurrentPrinter(session, &macPrinter); + QString printerId = QString::fromCFString(PMPrinterGetID(macPrinter)); + if (printer->printerName() != printerId) + printer->setPrinterName(printerId); } } -- cgit v1.2.3