http://macieira.org/~thiago/qt-5.3/QtPrintSupport.diff
diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h index c822aa0..886cd1e 100644 --- a/src/printsupport/dialogs/qprintdialog.h +++ b/src/printsupport/dialogs/qprintdialog.h @@ -106,7 +106,6 @@ Q_SIGNALS: private: #if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) - Q_PRIVATE_SLOT(d_func(), void _q_chbPrintLastFirstToggled(bool)) Q_PRIVATE_SLOT(d_func(), void _q_togglePageSetCombo(bool)) Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog()) # if !defined(QT_NO_MESSAGEBOX) diff --git a/src/printsupport/kernel/qprintengine.h b/src/printsupport/kernel/qprintengine.h index 3993a22..a69fe01 100644 --- a/src/printsupport/kernel/qprintengine.h +++ b/src/printsupport/kernel/qprintengine.h @@ -45,6 +45,8 @@ #include <QtCore/qvariant.h> #include <QtPrintSupport/qprinter.h> +Q_DECLARE_METATYPE(QMarginsF) + QT_BEGIN_NAMESPACE @@ -85,6 +87,9 @@ public: PPK_CopyCount, PPK_SupportsMultipleCopies, PPK_PaperName, + PPK_QPageSize, + PPK_QPageMargins, + PPK_QPageLayout, PPK_PaperSize = PPK_PageSize, PPK_CustomBase = 0xff00 diff --git a/src/printsupport/kernel/qprinter.h b/src/printsupport/kernel/qprinter.h index 2528157..fa102d0 100644 --- a/src/printsupport/kernel/qprinter.h +++ b/src/printsupport/kernel/qprinter.h @@ -45,6 +45,7 @@ #include <QtCore/qstring.h> #include <QtCore/qscopedpointer.h> #include <QtGui/qpagedpaintdevice.h> +#include <QtGui/qpagelayout.h> #include <QtPrintSupport/qtprintsupportglobal.h> QT_BEGIN_NAMESPACE @@ -60,6 +61,8 @@ class QPrinterPrivate; class QPaintEngine; class QPrintEngine; class QPrinterInfo; +class QPageSize; +class QPageMargins; class Q_PRINTSUPPORT_EXPORT QPrinter : public QPagedPaintDevice { @@ -75,13 +78,161 @@ public: enum Orientation { Portrait, Landscape }; + // ### Qt6 Remove in favor of QPage::PageSize + // NOTE: Must keep in sync with QPageSize and QPagedPaintDevice #ifndef Q_QDOC typedef PageSize PaperSize; #else - enum PaperSize { A4, B5, Letter, Legal, Executive, - A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, - B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, - DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom, NPaperSize = Custom }; + enum PaperSize { + // Existing Qt sizes + A4, + B5, + Letter, + Legal, + Executive, + A0, + A1, + A2, + A3, + A5, + A6, + A7, + A8, + A9, + B0, + B1, + B10, + B2, + B3, + B4, + B6, + B7, + B8, + B9, + C5E, + Comm10E, + DLE, + Folio, + Ledger, + Tabloid, + Custom, + + // New values derived from PPD standard + A10, + A3Extra, + A4Extra, + A4Plus, + A4Small, + A5Extra, + B5Extra, + + JisB0, + JisB1, + JisB2, + JisB3, + JisB4, + JisB5, + JisB6, + JisB7, + JisB8, + JisB9, + JisB10, + + // AnsiA = Letter, + // AnsiB = Ledger, + AnsiC, + AnsiD, + AnsiE, + LegalExtra, + LetterExtra, + LetterPlus, + LetterSmall, + TabloidExtra, + + ArchA, + ArchB, + ArchC, + ArchD, + ArchE, + + Imperial7x9, + Imperial8x10, + Imperial9x11, + Imperial9x12, + Imperial10x11, + Imperial10x13, + Imperial10x14, + Imperial12x11, + Imperial15x11, + + ExecutiveStandard, + Note, + Quarto, + Statement, + SuperA, + SuperB, + Postcard, + DoublePostcard, + Prc16K, + Prc32K, + Prc32KBig, + + FanFoldUS, + FanFoldGerman, + FanFoldGermanLegal, + + EnvelopeB4, + EnvelopeB5, + EnvelopeB6, + EnvelopeC0, + EnvelopeC1, + EnvelopeC2, + EnvelopeC3, + EnvelopeC4, + // EnvelopeC5 = C5E, + EnvelopeC6, + EnvelopeC65, + EnvelopeC7, + // EnvelopeDL = DLE, + + Envelope9, + // Envelope10 = Comm10E, + Envelope11, + Envelope12, + Envelope14, + EnvelopeMonarch, + EnvelopePersonal, + + EnvelopeChou3, + EnvelopeChou4, + EnvelopeInvite, + EnvelopeItalian, + EnvelopeKaku2, + EnvelopeKaku3, + EnvelopePrc1, + EnvelopePrc2, + EnvelopePrc3, + EnvelopePrc4, + EnvelopePrc5, + EnvelopePrc6, + EnvelopePrc7, + EnvelopePrc8, + EnvelopePrc9, + EnvelopePrc10, + EnvelopeYou4, + + // Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter + LastPageSize = EnvelopeYou4, + NPageSize = LastPageSize, + NPaperSize = LastPageSize, + + // Convenience overloads for naming consistency + AnsiA = Letter, + AnsiB = Ledger, + EnvelopeC5 = C5E, + EnvelopeDL = DLE, + Envelope10 = Comm10E + }; #endif enum PageOrder { FirstPageFirst, @@ -103,7 +254,10 @@ public: LargeCapacity, Cassette, FormSource, - MaxPageSource + MaxPageSource, // Deprecated + CustomSource, + LastPaperSource = CustomSource, + Upper = OnlyOne // As defined in Windows }; enum PrinterState { Idle, @@ -153,6 +307,18 @@ public: void setCreator(const QString &); QString creator() const; +#ifdef Q_QDOC + bool setPageLayout(const QPageLayout &pageLayout); + bool setPageSize(const QPageSize &pageSize); + bool setPageOrientation(QPageLayout::Orientation orientation); + bool setPageMargins(const QMarginsF &margins); + bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units); + QPageLayout pageLayout() const; +#else + using QPagedPaintDevice::setPageSize; + using QPagedPaintDevice::setPageMargins; +#endif + void setOrientation(Orientation); Orientation orientation() const; @@ -212,20 +378,16 @@ public: void setDoubleSidedPrinting(bool enable); bool doubleSidedPrinting() const; -#ifdef Q_OS_WIN void setWinPageSize(int winPageSize); int winPageSize() const; -#endif QRect paperRect() const; QRect pageRect() const; QRectF paperRect(Unit) const; QRectF pageRect(Unit) const; -#if !defined(Q_OS_WIN) || defined(Q_QDOC) QString printerSelectionOption() const; void setPrinterSelectionOption(const QString &); -#endif bool newPage(); bool abort(); diff --git a/src/printsupport/kernel/qprinterinfo.h b/src/printsupport/kernel/qprinterinfo.h index 0dc19c1..73ec48d 100644 --- a/src/printsupport/kernel/qprinterinfo.h +++ b/src/printsupport/kernel/qprinterinfo.h @@ -42,9 +42,11 @@ #ifndef QPRINTERINFO_H #define QPRINTERINFO_H +#include <QtPrintSupport/qprinter.h> + #include <QtCore/QList> #include <QtCore/QPair> -#include <QtPrintSupport/QPrinter> +#include <QtGui/qpagesize.h> QT_BEGIN_NAMESPACE @@ -69,12 +71,31 @@ public: bool isNull() const; bool isDefault() const; + bool isRemote() const; + + QPrinter::PrinterState state() const; + + QList<QPageSize> supportedPageSizes() const; + QPageSize defaultPageSize() const; + + bool supportsCustomPageSizes() const; - QList<QPrinter::PaperSize> supportedPaperSizes() const; - QList<QPair<QString, QSizeF> > supportedSizesWithNames() const; + QPageSize minimumPhysicalPageSize() const; + QPageSize maximumPhysicalPageSize() const; +#if QT_DEPRECATED_SINCE(5,3) + QT_DEPRECATED QList<QPrinter::PaperSize> supportedPaperSizes() const; + QT_DEPRECATED QList<QPair<QString, QSizeF> > supportedSizesWithNames() const; +#endif // QT_DEPRECATED_SINCE(5,3) + + QList<int> supportedResolutions() const; + + static QStringList availablePrinterNames(); static QList<QPrinterInfo> availablePrinters(); + + static QString defaultPrinterName(); static QPrinterInfo defaultPrinter(); + static QPrinterInfo printerInfo(const QString &printerName); private:
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development