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>
This commit is contained in:
Andy Shaw 2014-10-17 12:48:02 +02:00
parent 04912b6a3b
commit 591bce8f68

View File

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