1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtGui module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #include <qpagedpaintdevice.h>
44 class QPagedPaintDevicePrivate
47 QPagedPaintDevice::PageSize pageSize;
49 QPagedPaintDevice::Margins margins;
58 {215.9f, 279.4f}, // Letter
59 {215.9f, 355.6f}, // Legal
60 {190.5f, 254}, // Executive
81 {105, 241}, // US Common
84 {431.8f, 279.4f}, // Ledger
85 {279.4f, 431.8f} // Tabloid
89 \class QPagedPaintDevice
91 \brief The QPagedPaintDevice class is a represents a paintdevice that supports
96 Paged paint devices are used to generate output for printing or for formats like PDF.
97 QPdfWriter and QPrinter inherit from it.
101 Constructs a new paged paint device.
103 QPagedPaintDevice::QPagedPaintDevice()
104 : d(new QPagedPaintDevicePrivate)
111 QPagedPaintDevice::~QPagedPaintDevice()
117 \enum QPagedPaintDevice::PageSize
119 This enum type specifies the page size of the paint device.
121 \value A0 841 x 1189 mm
122 \value A1 594 x 841 mm
123 \value A2 420 x 594 mm
124 \value A3 297 x 420 mm
125 \value A4 210 x 297 mm, 8.26 x 11.69 inches
126 \value A5 148 x 210 mm
127 \value A6 105 x 148 mm
128 \value A7 74 x 105 mm
131 \value B0 1000 x 1414 mm
132 \value B1 707 x 1000 mm
133 \value B2 500 x 707 mm
134 \value B3 353 x 500 mm
135 \value B4 250 x 353 mm
136 \value B5 176 x 250 mm, 6.93 x 9.84 inches
137 \value B6 125 x 176 mm
138 \value B7 88 x 125 mm
141 \value B10 31 x 44 mm
142 \value C5E 163 x 229 mm
143 \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope
144 \value DLE 110 x 220 mm
145 \value Executive 7.5 x 10 inches, 190.5 x 254 mm
146 \value Folio 210 x 330 mm
147 \value Ledger 431.8 x 279.4 mm
148 \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm
149 \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm
150 \value Tabloid 279.4 x 431.8 mm
151 \value Custom Unknown, or a user defined size.
155 The page size can also be specified in millimeters using setPageSizeMM(). In this case the
156 page size enum is set to Custom.
160 \fn bool QPagedPaintDevice::newPage()
167 Sets the size of the a page to \a size.
171 void QPagedPaintDevice::setPageSize(PageSize size)
176 d->pageSizeMM = QSizeF(pageSizes[A4].width, pageSizes[A4].height);
180 Returns the currently used page size.
182 QPagedPaintDevice::PageSize QPagedPaintDevice::pageSize() const
188 Sets the page size to \a size. \a size is specified in millimeters.
190 void QPagedPaintDevice::setPageSizeMM(const QSizeF &size)
192 d->pageSize = Custom;
193 d->pageSizeMM = size;
197 Returns the page size in millimeters.
199 QSizeF QPagedPaintDevice::pageSizeMM() const
201 return d->pageSizeMM;
205 Sets the margins to be used to \a margins.
207 Margins are specified in millimeters.
209 The margins are purely a hint to the drawing method. They don't affect the
210 coordinate system or clipping.
214 void QPagedPaintDevice::setMargins(const Margins &margins)
216 d->margins = margins;
220 returns the current margins of the paint device. The default is 0.
224 QPagedPaintDevice::Margins QPagedPaintDevice::margins() const