diff options
Diffstat (limited to 'src/printsupport/kernel')
-rw-r--r-- | src/printsupport/kernel/kernel.pri | 5 | ||||
-rw-r--r-- | src/printsupport/kernel/qcups.cpp | 4 | ||||
-rw-r--r-- | src/printsupport/kernel/qplatformprintdevice.cpp | 26 | ||||
-rw-r--r-- | src/printsupport/kernel/qprintdevice_p.h | 2 | ||||
-rw-r--r-- | src/printsupport/kernel/qprinter.cpp | 2 | ||||
-rw-r--r-- | src/printsupport/kernel/qprinterinfo.cpp | 29 | ||||
-rw-r--r-- | src/printsupport/kernel/qprinterinfo.h | 3 |
7 files changed, 47 insertions, 24 deletions
diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri index ea7b4b9780..2ceaf152eb 100644 --- a/src/printsupport/kernel/kernel.pri +++ b/src/printsupport/kernel/kernel.pri @@ -33,7 +33,10 @@ win32 { $$PWD/qprintengine_win_p.h SOURCES += \ $$PWD/qprintengine_win.cpp - !winrt: LIBS_PRIVATE += -lwinspool -lcomdlg32 -lgdi32 -luser32 + !winrt { + LIBS_PRIVATE += -lwinspool -lcomdlg32 + QMAKE_USE_PRIVATE += user32 gdi32 + } } unix:!darwin:qtConfig(cups) { diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp index 8505e8356c..5236b8c8fa 100644 --- a/src/printsupport/kernel/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -44,12 +44,12 @@ QT_BEGIN_NAMESPACE -static QStringList cupsOptionsList(QPrinter *printer) Q_DECL_NOTHROW +static QStringList cupsOptionsList(QPrinter *printer) noexcept { return printer->printEngine()->property(PPK_CupsOptions).toStringList(); } -void setCupsOptions(QPrinter *printer, const QStringList &cupsOptions) Q_DECL_NOTHROW +void setCupsOptions(QPrinter *printer, const QStringList &cupsOptions) noexcept { printer->printEngine()->setProperty(PPK_CupsOptions, QVariant(cupsOptions)); } diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp index 69d984cb0c..3d76cad688 100644 --- a/src/printsupport/kernel/qplatformprintdevice.cpp +++ b/src/printsupport/kernel/qplatformprintdevice.cpp @@ -40,10 +40,8 @@ #include "qplatformprintdevice.h" #include "qprintdevice_p.h" -#if QT_CONFIG(printdialog) -#include "qprintdialog.h" -#endif +#include <QtCore/qcoreapplication.h> #include <QtGui/qpagelayout.h> QT_BEGIN_NAMESPACE @@ -165,7 +163,7 @@ QPageSize QPlatformPrintDevice::supportedPageSize(const QPageSize &pageSize) con // 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) { - for (const QPageSize &ps : m_pageSizes) { + for (const QPageSize &ps : qAsConst(m_pageSizes)) { if (ps.id() == pageSize.id() && ps.name() == pageSize.name()) return ps; } @@ -173,7 +171,7 @@ QPageSize QPlatformPrintDevice::supportedPageSize(const QPageSize &pageSize) con // Next try match on id only if not custom if (pageSize.id() != QPageSize::Custom) { - for (const QPageSize &ps : m_pageSizes) { + for (const QPageSize &ps : qAsConst(m_pageSizes)) { if (ps.id() == pageSize.id()) return ps; } @@ -188,7 +186,7 @@ QPageSize QPlatformPrintDevice::supportedPageSize(QPageSize::PageSizeId pageSize if (!m_havePageSizes) loadPageSizes(); - for (const QPageSize &ps : m_pageSizes) { + for (const QPageSize &ps : qAsConst(m_pageSizes)) { if (ps.id() == pageSizeId) return ps; } @@ -202,7 +200,7 @@ QPageSize QPlatformPrintDevice::supportedPageSize(const QString &pageName) const if (!m_havePageSizes) loadPageSizes(); - for (const QPageSize &ps : m_pageSizes) { + for (const QPageSize &ps : qAsConst(m_pageSizes)) { if (ps.name() == pageName) return ps; } @@ -235,7 +233,7 @@ QPageSize QPlatformPrintDevice::supportedPageSizeMatch(const QPageSize &pageSize return pageSize; // Try to find a supported page size based on point size - for (const QPageSize &ps : m_pageSizes) { + for (const QPageSize &ps : qAsConst(m_pageSizes)) { if (ps.sizePoints() == pageSize.sizePoints()) return ps; } @@ -291,11 +289,7 @@ QPrint::InputSlot QPlatformPrintDevice::defaultInputSlot() const { QPrint::InputSlot input; input.key = QByteArrayLiteral("Auto"); -#if QT_CONFIG(printdialog) - input.name = QPrintDialog::tr("Automatic"); -#else - input.name = QString::fromLatin1("Automatic"); -#endif + input.name = QCoreApplication::translate("Print Device Input Slot", "Automatic"); input.id = QPrint::Auto; return input; } @@ -315,11 +309,7 @@ QPrint::OutputBin QPlatformPrintDevice::defaultOutputBin() const { QPrint::OutputBin output; output.key = QByteArrayLiteral("Auto"); -#if QT_CONFIG(printdialog) - output.name = QPrintDialog::tr("Automatic"); -#else - output.name = QString::fromLatin1("Automatic"); -#endif + output.name = QCoreApplication::translate("Print Device Output Bin", "Automatic"); output.id = QPrint::AutoOutputBin; return output; } diff --git a/src/printsupport/kernel/qprintdevice_p.h b/src/printsupport/kernel/qprintdevice_p.h index a2b18f08cf..9e76c37617 100644 --- a/src/printsupport/kernel/qprintdevice_p.h +++ b/src/printsupport/kernel/qprintdevice_p.h @@ -76,9 +76,7 @@ public: ~QPrintDevice(); QPrintDevice &operator=(const QPrintDevice &other); - #ifdef Q_COMPILER_RVALUE_REFS QPrintDevice &operator=(QPrintDevice &&other) { swap(other); return *this; } -#endif void swap(QPrintDevice &other) { d.swap(other.d); } diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 829a13863b..ddcd8c4702 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -1848,7 +1848,7 @@ QList<int> QPrinter::supportedResolutions() const = d->printEngine->property(QPrintEngine::PPK_SupportedResolutions).toList(); QList<int> intlist; intlist.reserve(varlist.size()); - for (auto var : varlist) + for (const auto &var : varlist) intlist << var.toInt(); return intlist; } diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp index 4b092dee64..167b2361ef 100644 --- a/src/printsupport/kernel/qprinterinfo.cpp +++ b/src/printsupport/kernel/qprinterinfo.cpp @@ -400,6 +400,35 @@ QList<QPrinter::DuplexMode> QPrinterInfo::supportedDuplexModes() const } /*! + Returns the default color mode of this printer. + + \since 5.13 +*/ + +QPrinter::ColorMode QPrinterInfo::defaultColorMode() const +{ + Q_D(const QPrinterInfo); + return QPrinter::ColorMode(d->m_printDevice.defaultColorMode()); +} + +/*! + Returns the supported color modes of this printer. + + \since 5.13 +*/ + +QList<QPrinter::ColorMode> QPrinterInfo::supportedColorModes() const +{ + Q_D(const QPrinterInfo); + QList<QPrinter::ColorMode> list; + const auto supportedColorModes = d->m_printDevice.supportedColorModes(); + list.reserve(supportedColorModes.size()); + for (QPrint::ColorMode mode : supportedColorModes) + list << QPrinter::ColorMode(mode); + return list; +} + +/*! Returns a list of all the available Printer Names on this system. It is recommended to use this instead of availablePrinters() as diff --git a/src/printsupport/kernel/qprinterinfo.h b/src/printsupport/kernel/qprinterinfo.h index 8bac395ab3..7195cb76b5 100644 --- a/src/printsupport/kernel/qprinterinfo.h +++ b/src/printsupport/kernel/qprinterinfo.h @@ -93,6 +93,9 @@ public: QPrinter::DuplexMode defaultDuplexMode() const; QList<QPrinter::DuplexMode> supportedDuplexModes() const; + QPrinter::ColorMode defaultColorMode() const; + QList<QPrinter::ColorMode> supportedColorModes() const; + static QStringList availablePrinterNames(); static QList<QPrinterInfo> availablePrinters(); |