Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowsprinterinfo.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qprinterinfo.h"
5#include "qprinterinfo_p.h"
6
7#include <qstringlist.h>
8
9#include <qt_windows.h>
10
12
13using namespace Qt::StringLiterals;
14
15#ifndef QT_NO_PRINTER
16
17extern QPrinter::PaperSize mapDevmodePaperSize(int s);
18
19//QList<QPrinterInfo> QPrinterInfo::availablePrinters()
20//{
21// QList<QPrinterInfo> printers;
22
23// DWORD needed = 0;
24// DWORD returned = 0;
25// if (!EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, 0, 0, &needed, &returned)) {
26// LPBYTE buffer = new BYTE[needed];
27// if (EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, buffer, needed, &needed, &returned)) {
28// PPRINTER_INFO_4 infoList = reinterpret_cast<PPRINTER_INFO_4>(buffer);
29// QPrinterInfo defPrn = defaultPrinter();
30// for (uint i = 0; i < returned; ++i) {
31// QString printerName(QString::fromWCharArray(infoList[i].pPrinterName));
32
33// QPrinterInfo printerInfo(printerName);
34// if (printerInfo.printerName() == defPrn.printerName())
35// printerInfo.d_ptr->isDefault = true;
36// printers.append(printerInfo);
37// }
38// }
39// delete [] buffer;
40// }
41
42// return printers;
43//}
44
45//QPrinterInfo QPrinterInfo::defaultPrinter()
46//{
47// QString noPrinters("qt_no_printers"_L1);
48// wchar_t buffer[256];
49// GetProfileString(L"windows", L"device", (wchar_t*)noPrinters.utf16(), buffer, 256);
50// QString output = QString::fromWCharArray(buffer);
51// if (output != noPrinters) {
52// // Filter out the name of the printer, which should be everything before a comma.
53// QString printerName = output.split(u',').value(0);
54// QPrinterInfo printerInfo(printerName);
55// printerInfo.d_ptr->isDefault = true;
56// return printerInfo;
57// }
58
59// return QPrinterInfo();
60//}
61
62//QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
63//{
64// const Q_D(QPrinterInfo);
65
66// QList<QPrinter::PaperSize> paperSizes;
67// if (isNull())
68// return paperSizes;
69
70// DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
71// NULL, DC_PAPERS, NULL, NULL);
72// if ((int)size != -1) {
73// wchar_t *papers = new wchar_t[size];
74// size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()),
75// NULL, DC_PAPERS, papers, NULL);
76// for (int c = 0; c < (int)size; ++c)
77// paperSizes.append(mapDevmodePaperSize(papers[c]));
78// delete [] papers;
79// }
80
81// return paperSizes;
82//}
83
84#endif // QT_NO_PRINTER
85
Combined button and popup list for selecting options.
GLdouble s
[6]
Definition qopenglext.h:235
QPrinter::PaperSize mapDevmodePaperSize(int s)