Qt
6.x
The Qt SDK
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
11
QT_BEGIN_NAMESPACE
12
13
using namespace
Qt::StringLiterals
;
14
15
#ifndef QT_NO_PRINTER
16
17
extern
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
86
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1545
Qt::StringLiterals
Definition
qbytearray.h:716
s
GLdouble s
[6]
Definition
qopenglext.h:235
qprinterinfo.h
qprinterinfo_p.h
qstringlist.h
qt_windows.h
mapDevmodePaperSize
QPrinter::PaperSize mapDevmodePaperSize(int s)
qtbase
src
printsupport
platform
windows
qwindowsprinterinfo.cpp
Generated by
1.9.7