Commit 591bce8f authored by Andy Shaw's avatar Andy Shaw
Browse files

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: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
Showing with 3 additions and 3 deletions
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment