![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtGui More...
#include <qpagesize.h>
Public Member Functions | |
QPageSize () | |
Creates a null QPageSize. | |
Q_IMPLICIT | QPageSize (PageSizeId pageSizeId) |
Creates a QPageSize of the standard pageSize. | |
QPageSize (const QSize &pointSize, const QString &name=QString(), SizeMatchPolicy matchPolicy=FuzzyMatch) | |
Creates a QPageSize of the given pointSize in Points using the matching matchPolicy. | |
QPageSize (const QSizeF &size, Unit units, const QString &name=QString(), SizeMatchPolicy matchPolicy=FuzzyMatch) | |
Creates a custom page of the given size in units. | |
QPageSize (const QPageSize &other) | |
Copy constructor, copies other to this. | |
QPageSize & | operator= (const QPageSize &other) |
Assignment operator, assigns other to this. | |
~QPageSize () | |
Destroys the page. | |
void | swap (QPageSize &other) noexcept |
\memberswap{QPageSize} | |
bool | isEquivalentTo (const QPageSize &other) const |
Returns true if this page is equivalent to the other page, i.e. | |
bool | isValid () const |
Returns true if this page size is valid. | |
QString | key () const |
Returns the unique key of the page size. | |
QString | name () const |
Returns a localized human-readable name for the page size. | |
PageSizeId | id () const |
Returns the standard QPageSize::PageSizeId of the page, or QPageSize::Custom. | |
int | windowsId () const |
Returns the Windows DMPAPER enum value for the page size. | |
QSizeF | definitionSize () const |
Returns the definition size of the page size. | |
Unit | definitionUnits () const |
Returns the definition units of the page size. | |
QSizeF | size (Unit units) const |
Returns the size of the page in the required units. | |
QSize | sizePoints () const |
Returns the size of the page in Postscript Points (1/72 of an inch). | |
QSize | sizePixels (int resolution) const |
Returns the size of the page in Device Pixels at the given resolution. | |
QRectF | rect (Unit units) const |
Returns the page rectangle in the required units. | |
QRect | rectPoints () const |
Returns the page rectangle in Postscript Points (1/72 of an inch). | |
QRect | rectPixels (int resolution) const |
Returns the page rectangle in Device Pixels at the given resolution. | |
Static Public Member Functions | |
static QString | key (PageSizeId pageSizeId) |
Returns the PPD mediaOption keyword of the standard pageSizeId. | |
static QString | name (PageSizeId pageSizeId) |
Returns the localized name of the standard pageSizeId. | |
static PageSizeId | id (const QSize &pointSize, SizeMatchPolicy matchPolicy=FuzzyMatch) |
Returns the standard QPageSize::PageSizeId of the given pointSize in points using the given matchPolicy. | |
static PageSizeId | id (const QSizeF &size, Unit units, SizeMatchPolicy matchPolicy=FuzzyMatch) |
Returns the standard QPageSize::PageSizeId of the given size in units using the given matchPolicy. | |
static PageSizeId | id (int windowsId) |
Returns the PageSizeId for the given Windows DMPAPER enum value windowsId. | |
static int | windowsId (PageSizeId pageSizeId) |
Returns the Windows DMPAPER enum value of the standard pageSizeId. | |
static QSizeF | definitionSize (PageSizeId pageSizeId) |
Returns the definition size of the standard pageSizeId. | |
static Unit | definitionUnits (PageSizeId pageSizeId) |
Returns the definition units of the standard pageSizeId. | |
static QSizeF | size (PageSizeId pageSizeId, Unit units) |
Returns the size of the standard pageSizeId in the requested units. | |
static QSize | sizePoints (PageSizeId pageSizeId) |
Returns the size of the standard pageSizeId in Points. | |
static QSize | sizePixels (PageSizeId pageSizeId, int resolution) |
Returns the size of the standard pageSizeId in Device Pixels for the given resolution. | |
Friends | |
class | QPageSizePrivate |
class | QPlatformPrintDevice |
bool | operator== (const QPageSize &lhs, const QPageSize &rhs) |
Returns true if page size lhs is equal to page size rhs, i.e. | |
bool | operator!= (const QPageSize &lhs, const QPageSize &rhs) |
Returns true if page size lhs is unequal to page size rhs, i.e. | |
\inmodule QtGui
The QPageSize class describes the size and name of a defined page size.
This class implements support for the set of standard page sizes as defined in the Adobe Postscript PPD Standard v4.3. It defines the standard set of page sizes in points, millimeters and inches and ensures these sizes are consistently used. Other size units can be used but will be calculated results and so may not always be consistent. The defined point sizes are always a integer, all other sizes can be fractions of a unit.
The defined size is always in width x height order with no implied page orientation. Note that it is possible for page sizes to be defined where the width is greater than the height, such as QPageSize::Ledger, so you cannot rely on comparing the width and height values to determine page orientation.
For example, A4 is defined by the standard as 210mm x 297mm, 8.27in x 11.69in, or 595pt x 842pt.
You can also define custom page sizes with custom names in any units you want and this unit size will be preserved and used as the base for all other unit size calculations.
When creating a QPageSize using a custom QSize you can choose if you want QPageSize to try match the size to a standard page size. By default QPaperSize uses a FuzzyMatch mode where it will match a given page size to a standard page size if it falls within 3 postscript points of a defined standard size. You can override this to request only an exact match but this is not recommended as conversions between units can easily lose 3 points and result in incorrect page sizes.
A QPageSize instance may also be obtained by querying the supported page sizes for a print device. In this case the localized name returned is that defined by the printer itself. Note that the print device may not support the current default locale language.
The class also provides convenience methods for converting page size IDs to and from various unit sizes.
Definition at line 21 of file qpagesize.h.
This enum type lists the available page sizes as defined in the Postscript PPD standard.
These values are duplicated in QPagedPaintDevice and QPrinter.
The defined sizes are:
\value A0 841 x 1189 mm \value A1 594 x 841 mm \value A2 420 x 594 mm \value A3 297 x 420 mm \value A4 210 x 297 mm, 8.26 x 11.69 inches \value A5 148 x 210 mm \value A6 105 x 148 mm \value A7 74 x 105 mm \value A8 52 x 74 mm \value A9 37 x 52 mm \value B0 1000 x 1414 mm \value B1 707 x 1000 mm \value B2 500 x 707 mm \value B3 353 x 500 mm \value B4 250 x 353 mm \value B5 176 x 250 mm, 6.93 x 9.84 inches \value B6 125 x 176 mm \value B7 88 x 125 mm \value B8 62 x 88 mm \value B9 44 x 62 mm \value B10 31 x 44 mm \value C5E 163 x 229 mm \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope \value DLE 110 x 220 mm \value Executive 7.5 x 10 inches, 190.5 x 254 mm \value Folio 210 x 330 mm \value Ledger 431.8 x 279.4 mm \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm \value Tabloid 279.4 x 431.8 mm \value Custom Unknown, or a user defined size. \value A10 \value A3Extra \value A4Extra \value A4Plus \value A4Small \value A5Extra \value B5Extra \value JisB0 \value JisB1 \value JisB2 \value JisB3 \value JisB4 \value JisB5 \value JisB6, \value JisB7 \value JisB8 \value JisB9 \value JisB10 \value AnsiA = Letter \value AnsiB = Ledger \value AnsiC \value AnsiD \value AnsiE \value LegalExtra \value LetterExtra \value LetterPlus \value LetterSmall \value TabloidExtra \value ArchA \value ArchB \value ArchC \value ArchD \value ArchE \value Imperial7x9 \value Imperial8x10 \value Imperial9x11 \value Imperial9x12 \value Imperial10x11 \value Imperial10x13 \value Imperial10x14 \value Imperial12x11 \value Imperial15x11 \value ExecutiveStandard \value Note \value Quarto \value Statement \value SuperA \value SuperB \value Postcard \value DoublePostcard \value Prc16K \value Prc32K \value Prc32KBig \value FanFoldUS \value FanFoldGerman \value FanFoldGermanLegal \value EnvelopeB4 \value EnvelopeB5 \value EnvelopeB6 \value EnvelopeC0 \value EnvelopeC1 \value EnvelopeC2 \value EnvelopeC3 \value EnvelopeC4 \value EnvelopeC5 = C5E \value EnvelopeC6 \value EnvelopeC65 \value EnvelopeC7 \value EnvelopeDL = DLE \value Envelope9 \value Envelope10 = Comm10E \value Envelope11 \value Envelope12 \value Envelope14 \value EnvelopeMonarch \value EnvelopePersonal \value EnvelopeChou3 \value EnvelopeChou4 \value EnvelopeInvite \value EnvelopeItalian \value EnvelopeKaku2 \value EnvelopeKaku3 \value EnvelopePrc1 \value EnvelopePrc2 \value EnvelopePrc3 \value EnvelopePrc4 \value EnvelopePrc5 \value EnvelopePrc6 \value EnvelopePrc7 \value EnvelopePrc8 \value EnvelopePrc9 \value EnvelopePrc10 \value EnvelopeYou4 \value LastPageSize = EnvelopeYou4
Due to historic reasons QPageSize::Executive is not the same as the standard Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead.
The Postscript standard size QPageSize::Folio is different to the Windows DMPAPER_FOLIO size, use the Postscript standard size QPageSize::FanFoldGermanLegal if needed.
Definition at line 25 of file qpagesize.h.
\value FuzzyMatch Match to a standard page size if within the margin of tolerance.
\value FuzzyOrientationMatch Match to a standard page size if within the margin of tolerance regardless of orientation. \value ExactMatch Only match to a standard page size if the sizes match exactly.
Enumerator | |
---|---|
FuzzyMatch | |
FuzzyOrientationMatch | |
ExactMatch |
Definition at line 184 of file qpagesize.h.
enum QPageSize::Unit |
This enum type is used to specify the measurement unit for page sizes.
\value Millimeter \value Point 1/72th of an inch \value Inch \value Pica 1/72th of a foot, 1/6th of an inch, 12 Points \value Didot 1/72th of a French inch, 0.375 mm \value Cicero 1/6th of a French inch, 12 Didot, 4.5mm
Enumerator | |
---|---|
Millimeter | |
Point | |
Inch | |
Pica | |
Didot | |
Cicero |
Definition at line 175 of file qpagesize.h.
QPageSize::QPageSize | ( | ) |
Creates a null QPageSize.
Definition at line 1087 of file qpagesize.cpp.
QPageSize::QPageSize | ( | PageSizeId | pageSize | ) |
Creates a QPageSize of the standard pageSize.
If pageSize is QPageSize::Custom then the resulting QPageSize will not be valid. Use the custom size constructor instead.
Definition at line 1099 of file qpagesize.cpp.
|
explicit |
Creates a QPageSize of the given pointSize in Points using the matching matchPolicy.
If the given pointSize matches a standard QPageSize::PageSizeId, then that page size will be used. Note that if the matchPolicy is FuzzyMatch this may result in the pointSize being adjusted to the standard size. To prevent this happening use a matchPolicy of ExactMatch instead.
If the given pointSize is not a standard QPageSize::PageSizeId then a QPageSize::Custom size will be created.
If name is null then the standard localized name will be used. If a custom page size then a custom name in the format "Custom (width x height)" will be created.
The matchPolicy defaults to FuzzyMatch.
Definition at line 1121 of file qpagesize.cpp.
|
explicit |
Creates a custom page of the given size in units.
If the given size matches a standard QPageSize::PageSizeId, then that page size will be used. Note that if the matchPolicy is FuzzyMatch this may result in the size being adjusted to the standard size. To prevent this happening use a matchPolicy of ExactMatch instead.
If the given size is not a standard QPageSize::PageSizeId then a QPageSize::Custom size will be created. The original unit size will be preserved and used as the base for all other unit size calculations.
If name is null then a custom name will be created in the form "Custom (width x height)" where the size is expressed in units provided.
Definition at line 1142 of file qpagesize.cpp.
QPageSize::QPageSize | ( | const QPageSize & | other | ) |
Copy constructor, copies other to this.
Definition at line 1185 of file qpagesize.cpp.
QPageSize::~QPageSize | ( | ) |
Destroys the page.
Definition at line 1194 of file qpagesize.cpp.
QSizeF QPageSize::definitionSize | ( | ) | const |
Returns the definition size of the page size.
For a standard page size this will be the size as defined in the relevant standard, i.e. ISO A4 will be defined in millimeters while ANSI Letter will be defined in inches.
For a custom page size this will be the original size used to create the page size object.
If the QPageSize is invalid then the QSizeF will be invalid.
Definition at line 1349 of file qpagesize.cpp.
|
static |
Returns the definition size of the standard pageSizeId.
To obtain the definition units, call QPageSize::definitionUnits().
Definition at line 1775 of file qpagesize.cpp.
QPageSize::Unit QPageSize::definitionUnits | ( | ) | const |
Returns the definition units of the page size.
For a standard page size this will be the units as defined in the relevant standard, i.e. ISO A4 will be defined in millimeters while ANSI Letter will be defined in inches.
For a custom page size this will be the original units used to create the page size object.
If the QPageSize is invalid then the QPageSize::Unit will be invalid.
Definition at line 1369 of file qpagesize.cpp.
|
static |
Returns the definition units of the standard pageSizeId.
To obtain the definition size, call QPageSize::definitionSize().
Definition at line 1788 of file qpagesize.cpp.
QPageSize::PageSizeId QPageSize::id | ( | ) | const |
Returns the standard QPageSize::PageSizeId of the page, or QPageSize::Custom.
If the QPageSize is invalid then the ID will be QPageSize::Custom.
Definition at line 1311 of file qpagesize.cpp.
|
static |
Returns the standard QPageSize::PageSizeId of the given pointSize in points using the given matchPolicy.
If using FuzzyMatch then the point size of the PageSizeId returned may not exactly match the pointSize you passed in. You should call QPageSize::sizePoints() using the returned PageSizeId to find out the actual point size of the PageSizeId before using it in any calculations.
Definition at line 1725 of file qpagesize.cpp.
|
static |
Returns the standard QPageSize::PageSizeId of the given size in units using the given matchPolicy.
If using FuzzyMatch then the unit size of the PageSizeId returned may not exactly match the size you passed in. You should call QPageSize::size() using the returned PageSizeId to find out the actual unit size of the PageSizeId before using it in any calculations.
Definition at line 1740 of file qpagesize.cpp.
|
static |
Returns the PageSizeId for the given Windows DMPAPER enum value windowsId.
If there is no matching PageSizeId then QPageSize::Custom is returned.
Definition at line 1752 of file qpagesize.cpp.
bool QPageSize::isEquivalentTo | ( | const QPageSize & | other | ) | const |
Returns true
if this page is equivalent to the other page, i.e.
if the page has the same size regardless of other attributes like name.
Definition at line 1250 of file qpagesize.cpp.
bool QPageSize::isValid | ( | ) | const |
Returns true
if this page size is valid.
The page size may be invalid if created with an invalid PageSizeId, or a negative or invalid QSize or QSizeF, or the null constructor.
Definition at line 1264 of file qpagesize.cpp.
QString QPageSize::key | ( | ) | const |
Returns the unique key of the page size.
By default this is the PPD standard mediaOption keyword for the page size, or the PPD custom format key. If the QPageSize instance was obtained from a print device then this will be the key provided by the print device and may differ from the standard key.
If the QPageSize is invalid then the key will be an empty string.
This key should never be shown to end users, it is an internal key only. For a human-readable name use name().
Definition at line 1285 of file qpagesize.cpp.
|
static |
Returns the PPD mediaOption keyword of the standard pageSizeId.
If the QPageSize is invalid then the key will be empty.
Definition at line 1448 of file qpagesize.cpp.
QString QPageSize::name | ( | ) | const |
Returns a localized human-readable name for the page size.
If the QPageSize instance was obtained from a print device then the name used is that provided by the print device. Note that a print device may not support the current default locale language.
If the QPageSize is invalid then the name will be an empty string.
Definition at line 1300 of file qpagesize.cpp.
|
static |
Returns the localized name of the standard pageSizeId.
If the QPageSize is invalid then the name will be empty.
Definition at line 1467 of file qpagesize.cpp.
Assignment operator, assigns other to this.
Move-assigns other to this QPageSize instance, transferring the ownership of the managed pointer to this instance.
Definition at line 1202 of file qpagesize.cpp.
Returns the page rectangle in the required units.
If the QPageSize is invalid then the QRect will be invalid.
Definition at line 1413 of file qpagesize.cpp.
QRect QPageSize::rectPixels | ( | int | resolution | ) | const |
Returns the page rectangle in Device Pixels at the given resolution.
If the QPageSize is invalid then the QRect will be invalid.
Definition at line 1435 of file qpagesize.cpp.
QRect QPageSize::rectPoints | ( | ) | const |
Returns the page rectangle in Postscript Points (1/72 of an inch).
If the QPageSize is invalid then the QRect will be invalid.
Definition at line 1424 of file qpagesize.cpp.
|
static |
Returns the size of the standard pageSizeId in the requested units.
Definition at line 1799 of file qpagesize.cpp.
Returns the size of the page in the required units.
If the QPageSize is invalid then the QSizeF will be invalid.
Definition at line 1380 of file qpagesize.cpp.
QSize QPageSize::sizePixels | ( | int | resolution | ) | const |
Returns the size of the page in Device Pixels at the given resolution.
If the QPageSize is invalid then the QSize will be invalid.
Definition at line 1402 of file qpagesize.cpp.
|
static |
Returns the size of the standard pageSizeId in Device Pixels for the given resolution.
Definition at line 1822 of file qpagesize.cpp.
QSize QPageSize::sizePoints | ( | ) | const |
Returns the size of the page in Postscript Points (1/72 of an inch).
If the QPageSize is invalid then the QSize will be invalid.
Definition at line 1391 of file qpagesize.cpp.
|
static |
Returns the size of the standard pageSizeId in Points.
Definition at line 1810 of file qpagesize.cpp.
\memberswap{QPageSize}
Definition at line 204 of file qpagesize.h.
int QPageSize::windowsId | ( | ) | const |
Returns the Windows DMPAPER enum value for the page size.
Not all valid PPD page sizes have a Windows equivalent, in which case 0 will be returned.
If the QPageSize is invalid then the Windows ID will be 0.
Definition at line 1327 of file qpagesize.cpp.
|
static |
Returns the Windows DMPAPER enum value of the standard pageSizeId.
Not all valid PPD page sizes have a Windows equivalent, in which case 0 will be returned.
Definition at line 1764 of file qpagesize.cpp.
Returns true
if page size lhs is unequal to page size rhs, i.e.
if the page size has different attributes. Current attributes are size and name.
Definition at line 256 of file qpagesize.h.
Returns true
if page size lhs is equal to page size rhs, i.e.
if the page sizes have the same attributes. Current attributes are size and name.
Definition at line 254 of file qpagesize.h.
|
friend |
Definition at line 250 of file qpagesize.h.
|
friend |
Definition at line 251 of file qpagesize.h.