diff options
Diffstat (limited to 'src/printsupport')
24 files changed, 217 insertions, 57 deletions
diff --git a/src/printsupport/dialogs/dialogs.pri b/src/printsupport/dialogs/dialogs.pri index 9db975e202..9659046f60 100644 --- a/src/printsupport/dialogs/dialogs.pri +++ b/src/printsupport/dialogs/dialogs.pri @@ -8,7 +8,7 @@ HEADERS += \ dialogs/qprintdialog.h \ dialogs/qprintpreviewdialog.h -mac { +mac:!ios { OBJECTIVE_SOURCES += dialogs/qpagesetupdialog_mac.mm \ dialogs/qprintdialog_mac.mm LIBS += -framework Cocoa diff --git a/src/printsupport/dialogs/qabstractprintdialog.h b/src/printsupport/dialogs/qabstractprintdialog.h index 3fdaa0f57d..87979310b5 100644 --- a/src/printsupport/dialogs/qabstractprintdialog.h +++ b/src/printsupport/dialogs/qabstractprintdialog.h @@ -45,8 +45,6 @@ #include <QtWidgets/qdialog.h> #include <QtPrintSupport/qtprintsupportglobal.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -125,6 +123,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractPrintDialog::PrintDialogOptions) QT_END_NAMESPACE -QT_END_HEADER - #endif // QABSTRACTPRINTDIALOG_H diff --git a/src/printsupport/dialogs/qpagesetupdialog.h b/src/printsupport/dialogs/qpagesetupdialog.h index aebc540e41..c316e42166 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.h +++ b/src/printsupport/dialogs/qpagesetupdialog.h @@ -45,8 +45,6 @@ #include <QtWidgets/qdialog.h> #include <QtPrintSupport/qtprintsupportglobal.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -88,6 +86,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QPAGESETUPDIALOG_H diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 322d47d1fb..1e0251c6d2 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -360,7 +360,7 @@ void QPageSetupWidget::setupPrinter() const else { m_printer->setPaperSize(static_cast<QPrinter::PaperSize>(ps)); } - + m_printer->setPaperName(widget.paperSize->currentText()); #ifdef PSD_ENABLE_PAPERSOURCE m_printer->setPaperSource((QPrinter::PaperSource)widget.paperSource->currentIndex()); #endif @@ -380,16 +380,22 @@ void QPageSetupWidget::selectPrinter() int cupsDefaultSize = 0; QSize qtPreferredSize = m_printer->paperSize(QPrinter::Point).toSize(); + QString qtPaperName = m_printer->paperName(); bool preferredSizeMatched = false; for (int i = 0; i < numChoices; ++i) { widget.paperSize->addItem(QString::fromLocal8Bit(pageSizes->choices[i].text), QByteArray(pageSizes->choices[i].choice)); if (static_cast<int>(pageSizes->choices[i].marked) == 1) cupsDefaultSize = i; - QRect cupsPaperSize = cups.paperRect(pageSizes->choices[i].choice); - QSize diff = cupsPaperSize.size() - qtPreferredSize; - if (qAbs(diff.width()) < 5 && qAbs(diff.height()) < 5) { + if (qtPaperName == QString::fromLocal8Bit(pageSizes->choices[i].text)) { widget.paperSize->setCurrentIndex(i); preferredSizeMatched = true; + } else { + QRect cupsPaperSize = cups.paperRect(pageSizes->choices[i].choice); + QSize diff = cupsPaperSize.size() - qtPreferredSize; + if (qAbs(diff.width()) < 5 && qAbs(diff.height()) < 5) { + widget.paperSize->setCurrentIndex(i); + preferredSizeMatched = true; + } } } if (!preferredSizeMatched) @@ -452,7 +458,7 @@ void QPageSetupWidget::_q_paperSizeChanged() bool custom = size == QPrinter::Custom; #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - custom = custom ? m_cups : custom; + custom = custom && m_cups && (m_printer->paperName() == QLatin1String("Custom")); #endif widget.paperWidth->setEnabled(custom); diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h index 124eb8746c..7d77c6af07 100644 --- a/src/printsupport/dialogs/qprintdialog.h +++ b/src/printsupport/dialogs/qprintdialog.h @@ -44,8 +44,6 @@ #include <QtPrintSupport/qabstractprintdialog.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -121,6 +119,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QPRINTDIALOG_H diff --git a/src/printsupport/dialogs/qprintpreviewdialog.h b/src/printsupport/dialogs/qprintpreviewdialog.h index 4101cc8c20..b9c8737746 100644 --- a/src/printsupport/dialogs/qprintpreviewdialog.h +++ b/src/printsupport/dialogs/qprintpreviewdialog.h @@ -47,8 +47,6 @@ #ifndef QT_NO_PRINTPREVIEWDIALOG -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -99,8 +97,6 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QT_NO_PRINTPREVIEWDIALOG #endif // QPRINTPREVIEWDIALOG_H diff --git a/src/printsupport/doc/snippets/widgetprinting.cpp b/src/printsupport/doc/snippets/widgetprinting.cpp index 0204809988..3abef7a9a3 100644 --- a/src/printsupport/doc/snippets/widgetprinting.cpp +++ b/src/printsupport/doc/snippets/widgetprinting.cpp @@ -57,7 +57,7 @@ public: private slots: void print() { QPrinter printer(QPrinter::HighResolution); - + printer.setOutputFileName("test.pdf"); //! [0] diff --git a/src/printsupport/doc/src/qtprintsupport-index.qdoc b/src/printsupport/doc/src/qtprintsupport-index.qdoc index ea0d89aa34..dac915692e 100644 --- a/src/printsupport/doc/src/qtprintsupport-index.qdoc +++ b/src/printsupport/doc/src/qtprintsupport-index.qdoc @@ -40,12 +40,12 @@ generation facilities. \tableofcontents - + \section1 Classes Supporting Printing The following classes support the selecting and setting up of printers and printing output. - + \annotatedlist printing \section1 Paint Devices and Printing diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp index 30de3d301c..d2deee1db3 100644 --- a/src/printsupport/kernel/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +extern double qt_multiplierForUnit(QPrinter::Unit unit, int resolution); + typedef int (*CupsGetDests)(cups_dest_t **dests); typedef void (*CupsFreeDests)(int num_dests, cups_dest_t *dests); typedef const char* (*CupsGetPPD)(const char *printer); @@ -500,6 +502,25 @@ QList<QPrinter::PaperSize> QCUPSSupport::getCupsPrinterPaperSizes(int cupsPrinte return result; } +QList<QPair<QString, QSizeF> > QCUPSSupport::getCupsPrinterPaperSizesWithNames(int cupsPrinterIndex) +{ + QList<QPair<QString, QSizeF> > result; + if (!QCUPSSupport::isAvailable() || cupsPrinterIndex < 0) + return result; + // Find paper sizes from CUPS. + QCUPSSupport cups; + cups.setCurrentPrinter(cupsPrinterIndex); + if (const ppd_option_t* size = cups.pageSizes()) { + for (int j = 0; j < size->num_choices; ++j) { + double multiplier = qt_multiplierForUnit(QPrinter::Millimeter, 0); // resolution is not needed here + QSize sz = cups.paperRect(size->choices[j].choice).size(); + result.append(qMakePair(QString::fromUtf8(size->choices[j].text), QSizeF(sz.width() / multiplier, sz.height() / multiplier))); + } + } + return result; +} + + QT_END_NAMESPACE #endif // QT_NO_CUPS diff --git a/src/printsupport/kernel/qcups_p.h b/src/printsupport/kernel/qcups_p.h index 67a8955d93..0828f582a3 100644 --- a/src/printsupport/kernel/qcups_p.h +++ b/src/printsupport/kernel/qcups_p.h @@ -121,6 +121,7 @@ public: static QList<Printer> availableUnixPrinters(); static QList<QPrinter::PaperSize> getCupsPrinterPaperSizes(int cupsPrinterIndex); + static QList<QPair<QString, QSizeF> > getCupsPrinterPaperSizesWithNames(int cupsPrinterIndex); private: void collectMarkedOptions(QStringList& list, const ppd_group_t* group = 0) const; diff --git a/src/printsupport/kernel/qpaintengine_alpha_p.h b/src/printsupport/kernel/qpaintengine_alpha_p.h index 99b9b930e9..8a0781d0d3 100644 --- a/src/printsupport/kernel/qpaintengine_alpha_p.h +++ b/src/printsupport/kernel/qpaintengine_alpha_p.h @@ -53,6 +53,8 @@ // We mean it. // +#include <QtCore/qglobal.h> + #ifndef QT_NO_PRINTER #include "private/qpaintengine_p.h" #include <QtPrintSupport/qtprintsupportglobal.h> diff --git a/src/printsupport/kernel/qplatformprintersupport.cpp b/src/printsupport/kernel/qplatformprintersupport.cpp index f20ac5d177..4d80e55ab6 100644 --- a/src/printsupport/kernel/qplatformprintersupport.cpp +++ b/src/printsupport/kernel/qplatformprintersupport.cpp @@ -82,6 +82,11 @@ QList<QPrinter::PaperSize> QPlatformPrinterSupport::supportedPaperSizes(const QP return QList<QPrinter::PaperSize>(); } +QList<QPair<QString, QSizeF> > QPlatformPrinterSupport::supportedSizesWithNames(const QPrinterInfo &) const +{ + return QList<QPair<QString, QSizeF> >(); +} + QList<QPrinterInfo> QPlatformPrinterSupport::availablePrinters() { return m_printers; diff --git a/src/printsupport/kernel/qplatformprintersupport.h b/src/printsupport/kernel/qplatformprintersupport.h index 5d3c7d0aa6..c4ffcffd1e 100644 --- a/src/printsupport/kernel/qplatformprintersupport.h +++ b/src/printsupport/kernel/qplatformprintersupport.h @@ -55,8 +55,6 @@ #include <QtCore/qlist.h> #include <QtCore/qhash.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #ifndef QT_NO_PRINTER @@ -74,7 +72,7 @@ public: virtual QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode); virtual QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode); virtual QList<QPrinter::PaperSize> supportedPaperSizes(const QPrinterInfo &) const; - + virtual QList<QPair<QString, QSizeF> > supportedSizesWithNames(const QPrinterInfo &printerInfo) const; virtual QList<QPrinterInfo> availablePrinters(); virtual QPrinterInfo defaultPrinter(); virtual QPrinterInfo printerInfo(const QString &printerName); @@ -98,6 +96,4 @@ protected: QT_END_NAMESPACE -QT_END_HEADER - #endif // QPLATFORMPRINTERSUPPORT_H diff --git a/src/printsupport/kernel/qplatformprintplugin.h b/src/printsupport/kernel/qplatformprintplugin.h index 67af44cd68..4a5a94616a 100644 --- a/src/printsupport/kernel/qplatformprintplugin.h +++ b/src/printsupport/kernel/qplatformprintplugin.h @@ -55,8 +55,6 @@ #include <QtCore/qfactoryinterface.h> #include <QtPrintSupport/qtprintsupportglobal.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -78,6 +76,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QPLATFORMPRINTPLUGIN_H diff --git a/src/printsupport/kernel/qprintengine.h b/src/printsupport/kernel/qprintengine.h index 2abf3dda74..3993a22bef 100644 --- a/src/printsupport/kernel/qprintengine.h +++ b/src/printsupport/kernel/qprintengine.h @@ -45,8 +45,6 @@ #include <QtCore/qvariant.h> #include <QtPrintSupport/qprinter.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -86,6 +84,7 @@ public: PPK_PageMargins, PPK_CopyCount, PPK_SupportsMultipleCopies, + PPK_PaperName, PPK_PaperSize = PPK_PageSize, PPK_CustomBase = 0xff00 @@ -106,6 +105,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QPRINTENGINE_H diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index 97453f2e0e..c798ac0c7f 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -167,6 +167,16 @@ static int mapPaperSourceDevmode(QPrinter::PaperSource s) return sources[i].winSourceName ? sources[i].winSourceName : s; } +static inline uint qwcsnlen(const wchar_t *str, uint maxlen) +{ + uint length = 0; + if (str) { + while (length < maxlen && *str++) + length++; + } + return length; +} + QWin32PrintEngine::QWin32PrintEngine(QPrinter::PrinterMode mode) : QAlphaPaintEngine(*(new QWin32PrintEnginePrivate), PaintEngineFeatures(PrimitiveTransform @@ -1285,7 +1295,39 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->has_custom_paper_size = (QPrinter::PaperSize(value.toInt()) == QPrinter::Custom); d->doReinit(); break; - + case PPK_PaperName: + { + if (!d->devMode) + break; + DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), + NULL, DC_PAPERNAMES, NULL, NULL); + if ((int)size > 0) { + wchar_t *paperNames = new wchar_t[size*64]; + size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), + NULL, DC_PAPERNAMES, paperNames, NULL); + int paperPos = -1; + for (int i=0;i<(int)size;i++) { + wchar_t *copyOfPaper = paperNames + (i * 64); + if (value.toString() == QString::fromWCharArray(copyOfPaper, qwcsnlen(copyOfPaper, 64))) { + paperPos = i; + break; + } + } + delete [] paperNames; + size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), + NULL, DC_PAPERS, NULL, NULL); + if ((int)size > 0) { + wchar_t *papers = new wchar_t[size]; + size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), + NULL, DC_PAPERS, papers, NULL); + d->has_custom_paper_size = false; + d->devMode->dmPaperSize = papers[paperPos]; + d->doReinit(); + delete [] papers; + } + } + } + break; case PPK_PaperSource: { if (!d->devMode) @@ -1479,7 +1521,40 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const value = QTransform(1/d->stretch_x, 0, 0, 1/d->stretch_y, 0, 0).mapRect(d->devPaperRect); } break; + case PPK_PaperName: + if (!d->devMode) { + value = QLatin1String("A4"); + } else { + DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), + NULL, DC_PAPERS, NULL, NULL); + int paperSizePos = -1; + if ((int)size > 0) { + wchar_t *papers = new wchar_t[size]; + size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), + NULL, DC_PAPERS, papers, NULL); + for (int i=0;i<(int)size;i++) { + if (papers[i] == d->devMode->dmPaperSize) { + paperSizePos = i; + break; + } + } + delete [] papers; + } + if (paperSizePos != -1) { + size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), + NULL, DC_PAPERNAMES, NULL, NULL); + if ((int)size > 0) { + wchar_t *papers = new wchar_t[size*64]; + size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(d->name.utf16()), + NULL, DC_PAPERNAMES, papers, NULL); + wchar_t *copyOfPaper = papers + (paperSizePos * 64); + value = QString::fromWCharArray(copyOfPaper, qwcsnlen(copyOfPaper, 64)); + delete [] papers; + } + } + } + break; case PPK_PaperSource: if (!d->devMode) { value = QPrinter::Auto; @@ -1596,6 +1671,36 @@ QList<QPrinter::PaperSize> QWin32PrintEngine::supportedPaperSizes(const QPrinter return returnList; } +QList<QPair<QString, QSizeF> > QWin32PrintEngine::supportedSizesWithNames(const QPrinterInfo &printerInfo) +{ + QList<QPair<QString, QSizeF> > paperSizes; + if (printerInfo.isNull()) + return paperSizes; + DWORD size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()), + NULL, DC_PAPERNAMES, NULL, NULL); + if ((int)size > 0) { + wchar_t *papers = new wchar_t[size*64]; + size = DeviceCapabilities(reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()), + NULL, DC_PAPERNAMES, papers, NULL); + DWORD size2 = DeviceCapabilities(reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()), + NULL, DC_PAPERSIZE, NULL, NULL); + if ((int)size2 > 0) { + POINT *points = new POINT[size2*sizeof(POINT)]; + + size2 = DeviceCapabilities(reinterpret_cast<const wchar_t*>(printerInfo.printerName().utf16()), + NULL, DC_PAPERSIZE, (wchar_t *)points, NULL); + for (int i=0;i<(int)size;i++) { + wchar_t *paper = papers + (i * 64); + QString str = QString::fromWCharArray(paper, qwcsnlen(paper, 64)); + paperSizes << qMakePair(str, QSizeF(points[i].x / 10, points[i].y / 10)); + } + delete [] points; + } + delete [] papers; + } + return paperSizes; +} + void QWin32PrintEngine::queryDefaultPrinter(QString &name, QString &program, QString &port) { /* Read the default printer name, driver and port with the intuitive function diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h index 5197918710..93fe993088 100644 --- a/src/printsupport/kernel/qprintengine_win_p.h +++ b/src/printsupport/kernel/qprintengine_win_p.h @@ -53,6 +53,8 @@ // We mean it. // +#include <QtCore/qglobal.h> + #ifndef QT_NO_PRINTER #include <QtGui/qpaintengine.h> @@ -104,6 +106,7 @@ public: void releaseDC(HDC) const; static QList<QPrinter::PaperSize> supportedPaperSizes(const QPrinterInfo &printerInfo); + static QList<QPair<QString, QSizeF> > supportedSizesWithNames(const QPrinterInfo &printerInfo); static void queryDefaultPrinter(QString &name, QString &program, QString &port); private: diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index c1a2483f24..387101dc9b 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -1023,6 +1023,37 @@ QSizeF QPrinter::paperSize(Unit unit) const } /*! + \since 5.1 + + Sets the paper used by the printer to \a paperName. + + \sa paperName() +*/ + +void QPrinter::setPaperName(const QString &paperName) +{ + Q_D(QPrinter); + if (d->paintEngine->type() != QPaintEngine::Pdf) + ABORT_IF_ACTIVE("QPrinter::setPaperName"); + d->printEngine->setProperty(QPrintEngine::PPK_PaperName, paperName); + d->addToManualSetList(QPrintEngine::PPK_PaperName); +} + +/*! + \since 5.1 + + Returns the paper name of the paper set on the printer. + + The default value for this is driver-dependent. +*/ + +QString QPrinter::paperName() const +{ + Q_D(const QPrinter); + return d->printEngine->property(QPrintEngine::PPK_PaperName).toString(); +} + +/*! Sets the page order to \a pageOrder. The page order can be QPrinter::FirstPageFirst or @@ -1959,6 +1990,8 @@ QPrinter::PrintRange QPrinter::printRange() const \value PPK_PaperSources Specifies more than one QPrinter::PaperSource value. + \value PPK_PaperName A string specifying the name of the paper. + \value PPK_PaperSize Specifies a QPrinter::PaperSize value. \value PPK_PrinterName A string specifying the name of the printer. diff --git a/src/printsupport/kernel/qprinter.h b/src/printsupport/kernel/qprinter.h index 23ccb0c2d0..2528157532 100644 --- a/src/printsupport/kernel/qprinter.h +++ b/src/printsupport/kernel/qprinter.h @@ -47,8 +47,6 @@ #include <QtGui/qpagedpaintdevice.h> #include <QtPrintSupport/qtprintsupportglobal.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -169,6 +167,9 @@ public: void setPaperSize(const QSizeF &paperSize, Unit unit); QSizeF paperSize(Unit unit) const; + void setPaperName(const QString &paperName); + QString paperName() const; + void setPageOrder(PageOrder); PageOrder pageOrder() const; @@ -267,6 +268,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QPRINTER_H diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp index 32ed4fa5af..f863b23e34 100644 --- a/src/printsupport/kernel/qprinterinfo.cpp +++ b/src/printsupport/kernel/qprinterinfo.cpp @@ -222,6 +222,25 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const return d->paperSizes; } +/*! + Returns a list of all the paper names supported by the driver with the + corresponding size in millimeters. + + Not all printer drivers support this query, so the list may be empty. + + \since 5.1 +*/ + +QList<QPair<QString, QSizeF> > QPrinterInfo::supportedSizesWithNames() const +{ + Q_D(const QPrinterInfo); + if (!isNull() && !d->hasPaperNames) { + d->paperNames = QPlatformPrinterSupportPlugin::get()->supportedSizesWithNames(*this); + d->hasPaperNames = true; + } + return d->paperNames; +} + QList<QPrinterInfo> QPrinterInfo::availablePrinters() { QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); diff --git a/src/printsupport/kernel/qprinterinfo.h b/src/printsupport/kernel/qprinterinfo.h index 528423a635..0dc19c1da7 100644 --- a/src/printsupport/kernel/qprinterinfo.h +++ b/src/printsupport/kernel/qprinterinfo.h @@ -43,11 +43,9 @@ #define QPRINTERINFO_H #include <QtCore/QList> - +#include <QtCore/QPair> #include <QtPrintSupport/QPrinter> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -73,6 +71,7 @@ public: bool isDefault() const; QList<QPrinter::PaperSize> supportedPaperSizes() const; + QList<QPair<QString, QSizeF> > supportedSizesWithNames() const; static QList<QPrinterInfo> availablePrinters(); static QPrinterInfo defaultPrinter(); @@ -91,6 +90,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QPRINTERINFO_H diff --git a/src/printsupport/kernel/qprinterinfo_p.h b/src/printsupport/kernel/qprinterinfo_p.h index 97f4fd8a56..d4bb08f1f5 100644 --- a/src/printsupport/kernel/qprinterinfo_p.h +++ b/src/printsupport/kernel/qprinterinfo_p.h @@ -58,6 +58,7 @@ #ifndef QT_NO_PRINTER #include "QtCore/qlist.h" +#include "QtCore/qpair.h" QT_BEGIN_NAMESPACE @@ -65,7 +66,8 @@ class QPrinterInfoPrivate { public: QPrinterInfoPrivate(const QString& name = QString()) : - name(name), isDefault(false), index(-1), hasPaperSizes(false) + name(name), isDefault(false), index(-1), hasPaperSizes(false), + hasPaperNames(false) {} ~QPrinterInfoPrivate() {} @@ -81,6 +83,8 @@ public: mutable bool hasPaperSizes; mutable QList<QPrinter::PaperSize> paperSizes; + mutable bool hasPaperNames; + mutable QList<QPair<QString, QSizeF> > paperNames; }; diff --git a/src/printsupport/kernel/qtprintsupportglobal.h b/src/printsupport/kernel/qtprintsupportglobal.h index 1927252433..0fdb306e8d 100644 --- a/src/printsupport/kernel/qtprintsupportglobal.h +++ b/src/printsupport/kernel/qtprintsupportglobal.h @@ -44,8 +44,6 @@ #include <QtCore/qglobal.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #ifndef QT_STATIC @@ -60,6 +58,4 @@ QT_BEGIN_NAMESPACE QT_END_NAMESPACE -QT_END_HEADER - #endif // QTPRINTSUPPORTGLOBAL_H diff --git a/src/printsupport/widgets/qprintpreviewwidget.h b/src/printsupport/widgets/qprintpreviewwidget.h index b48af10ae0..85ff77d975 100644 --- a/src/printsupport/widgets/qprintpreviewwidget.h +++ b/src/printsupport/widgets/qprintpreviewwidget.h @@ -47,8 +47,6 @@ #ifndef QT_NO_PRINTPREVIEWWIDGET -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE @@ -116,7 +114,5 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QT_NO_PRINTPREVIEWWIDGET #endif // QPRINTPREVIEWWIDGET_H |