Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpagesize.h
Go to the documentation of this file.
1// Copyright (C) 2014 John Layt <jlayt@kde.org>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QPAGESIZE_H
5#define QPAGESIZE_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qsharedpointer.h>
9
11
12#if defined(B0)
13#undef B0 // Terminal hang-up. We assume that you do not want that.
14#endif
15
17class QString;
18class QSize;
19class QSizeF;
20
21class Q_GUI_EXPORT QPageSize
22{
23public:
24
26 // Old Qt sizes
59
60 // New values derived from PPD standard
67
79
80 // AnsiA = Letter,
81 // AnsiB = Ledger,
90
96
106
118
122
131 // EnvelopeC5 = C5E,
135 // EnvelopeDL = DLE,
136
138 // Envelope10 = Comm10E,
144
162
163 // Last item
164 LastPageSize = EnvelopeYou4,
165
166 // Convenience overloads for naming consistency
167 AnsiA = Letter,
168 AnsiB = Ledger,
169 EnvelopeC5 = C5E,
170 EnvelopeDL = DLE,
171 Envelope10 = Comm10E
172 };
173
174 // NOTE: Must keep in sync with QPageLayout::Unit and QPrinter::Unit
183
189
190 QPageSize();
191 Q_IMPLICIT QPageSize(PageSizeId pageSizeId);
192 explicit QPageSize(const QSize &pointSize,
193 const QString &name = QString(),
194 SizeMatchPolicy matchPolicy = FuzzyMatch);
195 explicit QPageSize(const QSizeF &size, Unit units,
196 const QString &name = QString(),
197 SizeMatchPolicy matchPolicy = FuzzyMatch);
198 QPageSize(const QPageSize &other);
199 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageSize)
200 QPageSize &operator=(const QPageSize &other);
201 ~QPageSize();
202
203
204 void swap(QPageSize &other) noexcept { d.swap(other.d); }
205
206#if QT_GUI_REMOVED_SINCE(6, 4)
207 friend Q_GUI_EXPORT bool operator==(const QPageSize &lhs, const QPageSize &rhs);
208#endif
209 bool isEquivalentTo(const QPageSize &other) const;
210
211 bool isValid() const;
212
213 QString key() const;
214 QString name() const;
215
216 PageSizeId id() const;
217
218 int windowsId() const;
219
220 QSizeF definitionSize() const;
221 Unit definitionUnits() const;
222
223 QSizeF size(Unit units) const;
224 QSize sizePoints() const;
225 QSize sizePixels(int resolution) const;
226
227 QRectF rect(Unit units) const;
228 QRect rectPoints() const;
229 QRect rectPixels(int resolution) const;
230
231 static QString key(PageSizeId pageSizeId);
232 static QString name(PageSizeId pageSizeId);
233
234 static PageSizeId id(const QSize &pointSize,
235 SizeMatchPolicy matchPolicy = FuzzyMatch);
236 static PageSizeId id(const QSizeF &size, Unit units,
237 SizeMatchPolicy matchPolicy = FuzzyMatch);
238
239 static PageSizeId id(int windowsId);
240 static int windowsId(PageSizeId pageSizeId);
241
242 static QSizeF definitionSize(PageSizeId pageSizeId);
243 static Unit definitionUnits(PageSizeId pageSizeId);
244
245 static QSizeF size(PageSizeId pageSizeId, Unit units);
246 static QSize sizePoints(PageSizeId pageSizeId);
247 static QSize sizePixels(PageSizeId pageSizeId, int resolution);
248
249private:
250 friend class QPageSizePrivate;
252
253 bool equals(const QPageSize &other) const;
254 friend inline bool operator==(const QPageSize &lhs, const QPageSize &rhs)
255 { return lhs.equals(rhs); }
256 friend inline bool operator!=(const QPageSize &lhs, const QPageSize &rhs)
257 { return !(lhs == rhs); }
258
259 QPageSize(const QString &key, const QSize &pointSize, const QString &name);
260 QPageSize(int windowsId, const QSize &pointSize, const QString &name);
262 QSharedDataPointer<QPageSizePrivate> d;
263};
264
265Q_DECLARE_SHARED(QPageSize)
266
267#ifndef QT_NO_DEBUG_STREAM
268Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageSize &pageSize);
269#endif
270
272
274QT_DECL_METATYPE_EXTERN_TAGGED(QPageSize::PageSizeId, QPageSize__PageSizeId, Q_GUI_EXPORT)
275QT_DECL_METATYPE_EXTERN_TAGGED(QPageSize::Unit, QPageSize__Unit, Q_GUI_EXPORT)
276
277#endif // QPAGESIZE_H
\inmodule QtCore
\inmodule QtGui
Definition qpagesize.h:22
Unit
This enum type is used to specify the measurement unit for page sizes.
Definition qpagesize.h:175
friend bool operator==(const QPageSize &lhs, const QPageSize &rhs)
Returns true if page size lhs is equal to page size rhs, i.e.
Definition qpagesize.h:254
void swap(QPageSize &other) noexcept
Swaps this QPageSize with other.
Definition qpagesize.h:204
friend bool operator!=(const QPageSize &lhs, const QPageSize &rhs)
Returns true if page size lhs is unequal to page size rhs, i.e.
Definition qpagesize.h:256
SizeMatchPolicy
\value FuzzyMatch Match to a standard page size if within the margin of tolerance.
Definition qpagesize.h:184
@ FuzzyOrientationMatch
Definition qpagesize.h:186
PageSizeId
This enum type lists the available page sizes as defined in the Postscript PPD standard.
Definition qpagesize.h:25
@ DoublePostcard
Definition qpagesize.h:114
@ Imperial12x11
Definition qpagesize.h:104
@ Imperial8x10
Definition qpagesize.h:98
@ Imperial10x11
Definition qpagesize.h:101
@ EnvelopePersonal
Definition qpagesize.h:143
@ EnvelopePrc10
Definition qpagesize.h:160
@ EnvelopeChou4
Definition qpagesize.h:146
@ Imperial10x13
Definition qpagesize.h:102
@ ExecutiveStandard
Definition qpagesize.h:107
@ FanFoldGerman
Definition qpagesize.h:120
@ EnvelopeKaku2
Definition qpagesize.h:149
@ Imperial9x11
Definition qpagesize.h:99
@ EnvelopeChou3
Definition qpagesize.h:145
@ TabloidExtra
Definition qpagesize.h:89
@ EnvelopeMonarch
Definition qpagesize.h:142
@ EnvelopeInvite
Definition qpagesize.h:147
@ Imperial10x14
Definition qpagesize.h:103
@ EnvelopeKaku3
Definition qpagesize.h:150
@ FanFoldGermanLegal
Definition qpagesize.h:121
@ LetterSmall
Definition qpagesize.h:88
@ EnvelopeItalian
Definition qpagesize.h:148
@ Imperial15x11
Definition qpagesize.h:105
@ LetterExtra
Definition qpagesize.h:86
@ Imperial7x9
Definition qpagesize.h:97
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:208
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
rect
[4]
Combined button and popup list for selecting options.
#define Q_IMPLICIT
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1388
#define QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TAG, EXPORT)
Definition qmetatype.h:1376
GLuint64 key
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint id
[7]
GLfloat units
GLuint name
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageSize &pageSize)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
QSharedPointer< T > other(t)
[5]