QPageSize QPlatformPrintDevice::supportedPageSize(const QPageSize &pageSize) const { if (!pageSize.isValid()) return QPageSize(); if (!m_havePageSizes) loadPageSizes(); // First try match on name and id for case where printer defines same size twice with different names // e.g. Windows defines DMPAPER_11X17 and DMPAPER_TABLOID with names "11x17" and "Tabloid", but both // map to QPageSize::Tabloid / PPD Key "Tabloid" / ANSI B Tabloid if (pageSize.id() != QPageSize::Custom) { foreach (const QPageSize &ps, m_pageSizes) { if (ps.id() == pageSize.id() && ps.name() == pageSize.name()) return ps; } }
QPageSize::PageSizeId KReportPageSize::defaultSize() { QPrinterInfo printerInfo = QPrinterInfo::defaultPrinter(); QPageSize size = printerInfo.defaultPageSize(); if (size.isValid()) { return size.id(); } return QPageSize::A4; }