summaryrefslogtreecommitdiffstats
path: root/src/plugins/printsupport
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2014-10-17 12:48:02 +0200
committerAndy Shaw <andy.shaw@digia.com>2014-10-23 17:24:06 +0200
commit591bce8f6877ffb8e4ab81330ec077231eb2aab7 (patch)
tree2069c027189e5dd0d4bdf2e2c8e0bf09dbaca121 /src/plugins/printsupport
parent04912b6a3bcff9087d0679b224cfccee3c05bd10 (diff)
Get the correct available resolutions from the printer
On Windows the resolutions are available in pairs so get the y resolution from each pair as the y resolution is the one that is actually useful in QtPrintSupport terms Task-number: QTBUG-42007 Change-Id: I02c0588dd97c541e679f22431435751563caadb2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins/printsupport')
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintdevice.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
index 0a21193216..0feea5ea74 100644
--- a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
+++ b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
@@ -280,11 +280,11 @@ void QWindowsPrintDevice::loadResolutions() const
{
DWORD resCount = DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_ENUMRESOLUTIONS, NULL, NULL);
if (int(resCount) > 0) {
- QScopedArrayPointer<LONG> resolutions(new LONG[resCount*sizeof(LONG)]);
+ QScopedArrayPointer<LONG> resolutions(new LONG[resCount*2]);
// Get the details and match the default paper size
if (DeviceCapabilities((LPWSTR)m_id.utf16(), NULL, DC_ENUMRESOLUTIONS, (LPWSTR)resolutions.data(), NULL) == resCount) {
- for (int i = 0; i < int(resCount); ++i)
- m_resolutions.append(resolutions[i]);
+ for (int i = 0; i < int(resCount * 2); i += 2)
+ m_resolutions.append(resolutions[i+1]);
}
}
m_haveResolutions = true;