summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qprintengine_mac.mm
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-29 12:34:31 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-29 12:34:31 +0100
commita224dfc9d19757734bf49fcefdeaad5d855dfe98 (patch)
tree83b61bea7fa243557febe9652f3f16d265a2689a /src/plugins/platforms/cocoa/qprintengine_mac.mm
parentbe84480785b9686dc09937fa33b685de7cc570f1 (diff)
parentf253f4c3310655933266f62e90f46fd12b5c49e4 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: tests/auto/corelib/io/qprocess/tst_qprocess.cpp Change-Id: Ib6955eb874b516b185b45d6c38cec646fbaa95f4
Diffstat (limited to 'src/plugins/platforms/cocoa/qprintengine_mac.mm')
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index 339b9b56ce..3d0c91c36c 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -476,7 +476,6 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
d->embedFonts = value.toBool();
break;
case PPK_Resolution: {
- // TODO It appears the old code didn't actually set the resolution??? Can we delete all this???
int bestResolution = 0;
int dpi = value.toInt();
int bestDistance = INT_MAX;
@@ -492,7 +491,17 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
}
}
}
- PMSessionValidatePageFormat(d->session(), d->format(), kPMDontWantBoolean);
+ PMResolution resolution;
+ resolution.hRes = resolution.vRes = bestResolution;
+ if (PMPrinterSetOutputResolution(d->m_printDevice->macPrinter(), d->settings(), &resolution) == noErr) {
+ // Setting the resolution succeeded.
+ // Now try to read the actual resolution selected by the OS.
+ if (PMPrinterGetOutputResolution(d->m_printDevice->macPrinter(), d->settings(), &d->resolution) != noErr) {
+ // Reading the resolution somehow failed; d->resolution is in undefined state.
+ // So use the value which was acceptable to PMPrinterSetOutputResolution.
+ d->resolution = resolution;
+ }
+ }
break;
}
case PPK_CollateCopies: