summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpagedpaintdevice.h
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-12-26 11:14:53 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-17 13:45:47 +0100
commit4ab55a01e96b6ac398d3a9afa2c93032e305f30b (patch)
tree9fd240e7fbfa3af6f08905ee7a275763a4b0bfe0 /src/gui/painting/qpagedpaintdevice.h
parentb0428926cece7bc362bc24c2eb1621b9fef737c7 (diff)
QPagedPaintDevice - Use QPageSize and QPageLayout
Use new QPageLayout and QPageSize class to store and convert page sizes and layouts consistently. Extend the PageSize enum to match QPage::PageSize. Note that public setters/getters cannot be added as virtuals would break BIC, but without virtuals the derived classes would break. Instead an internal api is provided and the derived classes will need to implement identical api to manipulate it. [ChangeLog][QtGui][QPagedPaintDevice] Paged paint devices such as QPrinter and QPdfWriter now support all Postscript standard page sizes. Task-number: QTBUG-27685 Task-number: QTBUG-25744 Change-Id: I62e96ab94194ab4ac8bed8fa804e0ce1c3233313 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/painting/qpagedpaintdevice.h')
-rw-r--r--src/gui/painting/qpagedpaintdevice.h159
1 files changed, 155 insertions, 4 deletions
diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h
index a4e8ff1a48..6d4c422a95 100644
--- a/src/gui/painting/qpagedpaintdevice.h
+++ b/src/gui/painting/qpagedpaintdevice.h
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
#endif
class QPagedPaintDevicePrivate;
+class QPageLayout;
class Q_GUI_EXPORT QPagedPaintDevice : public QPaintDevice
{
@@ -61,10 +62,157 @@ public:
virtual bool newPage() = 0;
// ### Qt6 Remove in favor of QPage::PageSize
- enum PageSize { 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 };
+ // NOTE: Must keep in sync with QPageSize and QPrinter
+ enum PageSize {
+ // 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
+ };
virtual void setPageSize(PageSize size);
PageSize pageSize() const;
@@ -72,6 +220,7 @@ public:
virtual void setPageSizeMM(const QSizeF &size);
QSizeF pageSizeMM() const;
+ // ### Qt6 Remove in favor of QMarginsF
struct Margins {
qreal left;
qreal right;
@@ -83,6 +232,8 @@ public:
Margins margins() const;
protected:
+ QPageLayout devicePageLayout() const;
+ QPageLayout &devicePageLayout();
friend class QPagedPaintDevicePrivate;
QPagedPaintDevicePrivate *d;
};