diff options
author | John Layt <jlayt@kde.org> | 2013-12-18 21:51:12 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-17 13:45:44 +0100 |
commit | b0428926cece7bc362bc24c2eb1621b9fef737c7 (patch) | |
tree | e5497f1b5c2f7bdacb5e7e0ba9898f9423884e26 /src/printsupport/kernel/qprintengine_win.cpp | |
parent | cf8b8340f3d283830a6aca2f708e839bb70d6d57 (diff) |
QPrinterInfo - Switch to QPlatformPrintDevice
Change the QPrinterInfo implementation to use QPlatformPrintDevice as
the backend. Remove all the old QPrinterInfo related code from the
QPA plugin. Add public api to QPrinterInfo to support some features
from QPlatformPrintDevice.
[ChangeLog][QtPrintSupport][QPrinterInfo] Added new public api for
isRemote(), state(), defaultPageSize(), supportedPageSizes(),
supportsCustomPageSizes(), minimumPhysicalPageSize(),
maximumPhysicalPageSize(), supportedResolutions(),
availablePrinterNames(), and defaultPrinterName(). The use of
availablePrinters() is discouraged due to performance concerns.
Task-number: QTBUG-35248
Change-Id: Ic38323a930549ad67bf04a1a6bb43d623dfe6a33
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/printsupport/kernel/qprintengine_win.cpp')
-rw-r--r-- | src/printsupport/kernel/qprintengine_win.cpp | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 02b5d824f4..c5f5057b14 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -1733,49 +1733,6 @@ void QWin32PrintEngine::releaseDC(HDC) const } -QList<QPrinter::PaperSize> QWin32PrintEngine::supportedPaperSizes(const QPrinterInfo &printerInfo) -{ - QList<QPrinter::PaperSize> returnList; - - if (printerInfo.isNull()) - return returnList; - const wchar_t *name = reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()); - DWORD size = DeviceCapabilities(name, NULL, DC_PAPERS, NULL, NULL); - if ((int)size != -1) { - QScopedArrayPointer<wchar_t> papers(new wchar_t[size]); - if (size != DeviceCapabilities(name, NULL, DC_PAPERS, papers.data(), NULL)) - return returnList; - for (int c = 0; c < (int)size; ++c) - returnList.append(mapDevmodePaperSize(papers[c])); - } - return returnList; -} - -QList<QPair<QString, QSizeF> > QWin32PrintEngine::supportedSizesWithNames(const QPrinterInfo &printerInfo) -{ - QList<QPair<QString, QSizeF> > paperSizes; - if (printerInfo.isNull()) - return paperSizes; - const wchar_t *name = reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()); - DWORD size = DeviceCapabilities(name, NULL, DC_PAPERNAMES, NULL, NULL); - if ((int)size > 0) { - QScopedArrayPointer<wchar_t> papers(new wchar_t[size*64]); - if (size != DeviceCapabilities(name, NULL, DC_PAPERNAMES, papers.data(), NULL)) - return paperSizes; - if (size != DeviceCapabilities(name, NULL, DC_PAPERSIZE, NULL, NULL)) - return paperSizes; - QScopedArrayPointer<POINT> points(new POINT[size*sizeof(POINT)]); - if (size != DeviceCapabilities(name, NULL, DC_PAPERSIZE, (wchar_t *)points.data(), NULL)) - return paperSizes; - for (int i = 0; i < (int)size; ++i) { - wchar_t *paper = papers.data() + (i * 64); - QString str = QString::fromWCharArray(paper, qwcsnlen(paper, 64)); - paperSizes << qMakePair(str, QSizeF(points[i].x / 10.0, points[i].y / 10.0)); - } - } - return paperSizes; -} - void QWin32PrintEngine::queryDefaultPrinter(QString &name) { /* Read the default printer name, driver and port with the intuitive function |