61 if (!EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, 0, 0, &needed, &returned)) {
62 LPBYTE buffer =
new BYTE[needed];
63 if (EnumPrinters(PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, buffer, needed, &needed, &returned)) {
64 PPRINTER_INFO_4 infoList =
reinterpret_cast<PPRINTER_INFO_4
>(buffer);
66 for (
uint i = 0; i < returned; ++i) {
70 if (printerInfo.printerName() == defPrn.
printerName())
71 printerInfo.d_ptr->isDefault =
true;
72 printers.
append(printerInfo);
85 GetProfileString(L
"windows", L
"device", (
wchar_t*)noPrinters.utf16(), buffer, 256);
87 if (output != noPrinters) {
91 printerInfo.d_ptr->isDefault =
true;
106 DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(
d->name.utf16()),
107 NULL, DC_PAPERS, NULL, NULL);
108 if ((
int)size != -1) {
109 wchar_t *papers =
new wchar_t[size];
110 size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(
d->name.utf16()),
111 NULL, DC_PAPERS, papers, NULL);
112 for (
int c = 0;
c < (int)size; ++
c)
120 #endif // QT_NO_PRINTER static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
static QPrinterInfo defaultPrinter()
Returns the default printer on the system.
QPrinterInfo()
Constructs an empty QPrinterInfo object.
QList< QPrinter::PaperSize > supportedPaperSizes() const
Returns a list of supported paper sizes by the printer.
#define QT_END_NAMESPACE
This macro expands to.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
T value(int i) const
Returns the value at index position i in the list.
The QPrinterInfo class gives access to information about existing printers.
QString printerName() const
Returns the name of the printer.
PaperSize
This enum type specifies what paper size QPrinter should use.
QPrinter::PaperSize mapDevmodePaperSize(int s)
static QList< QPrinterInfo > availablePrinters()
Returns a list of available printers on the system.
bool isNull() const
Returns whether this QPrinterInfo object holds a printer definition.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
The QList class is a template class that provides lists.