def
__eq__
(, rhs)
def
__ne__
(, rhs)
def
definitionSize
()
def
definitionUnits
()
def
id
()
def
isEquivalentTo
(other)
def
isValid
()
def
key
()
def
name
()
def
rect
(units)
def
rectPixels
(resolution)
def
rectPoints
()
def
size
(units)
def
sizePixels
(resolution)
def
sizePoints
()
def
swap
(other)
def
windowsId
()
def
definitionSize
(pageSizeId)
def
definitionUnits
(pageSizeId)
def
id
(pointSize[, matchPolicy=FuzzyMatch])
def
id
(size, units[, matchPolicy=FuzzyMatch])
def
id
(windowsId)
def
key
(pageSizeId)
def
name
(pageSizeId)
def
size
(pageSizeId, units)
def
sizePixels
(pageSizeId, resolution)
def
sizePoints
(pageSizeId)
def
windowsId
(pageSizeId)
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
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.
当创建
QPageSizeusing a customQSizeyou can choose if you wantQPageSizeto try match the size to a standard page size. By default QPaperSize uses aFuzzyMatchmode 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
QPageSizeinstance 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.
QPageSize
¶
QPageSize(pageSizeId)
QPageSize(other)
QPageSize(pointSize[, name=””[, matchPolicy=FuzzyMatch]])
QPageSize(size, units[, name=””[, matchPolicy=FuzzyMatch]])
- param pageSizeId
PageSizeId- param matchPolicy
SizeMatchPolicy- param pointSize
QSize- param name
unicode
- param size
QSizeF- param other
- param units
Unit
Creates a null
QPageSize
.
创建
QPageSize
of the standard
pageSize
.
若
pageSize
is
自定义
then the resulting
QPageSize
will not be valid. Use the custom size constructor instead.
Creates a custom page of the given
size
in
units
.
若给定
size
matches a standard
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
代替。
若给定
size
is not a standard
PageSizeId
then a
自定义
size will be created. The original unit size will be preserved and used as the base for all other unit size calculations.
若
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.
PySide2.QtGui.QPageSize.
PageSizeId
¶
This enum type lists the available page sizes as defined in the Postscript PPD standard. These values are duplicated in
QPagedPaintDevice
and
QPrinter
.
定义尺寸:
|
常量 |
描述 |
|---|---|
|
QPageSize.A0 |
841 x 1189 mm |
|
QPageSize.A1 |
594 x 841 mm |
|
QPageSize.A2 |
420 x 594 mm |
|
QPageSize.A3 |
297 x 420 mm |
|
QPageSize.A4 |
210 x 297 mm, 8.26 x 11.69 inches |
|
QPageSize.A5 |
148 x 210 mm |
|
QPageSize.A6 |
105 x 148 mm |
|
QPageSize.A7 |
74 x 105 mm |
|
QPageSize.A8 |
52 x 74 mm |
|
QPageSize.A9 |
37 x 52 mm |
|
QPageSize.B0 |
1000 x 1414 mm |
|
QPageSize.B1 |
707 x 1000 mm |
|
QPageSize.B2 |
500 x 707 mm |
|
QPageSize.B3 |
353 x 500 mm |
|
QPageSize.B4 |
250 x 353 mm |
|
QPageSize.B5 |
176 x 250 mm, 6.93 x 9.84 inches |
|
QPageSize.B6 |
125 x 176 mm |
|
QPageSize.B7 |
88 x 125 mm |
|
QPageSize.B8 |
62 x 88 mm |
|
QPageSize.B9 |
44 x 62 mm |
|
QPageSize.B10 |
31 x 44 mm |
|
QPageSize.C5E |
163 x 229 mm |
|
QPageSize.Comm10E |
105 x 241 mm, U.S. Common 10 Envelope |
|
QPageSize.DLE |
110 x 220 mm |
|
QPageSize.Executive |
7.5 x 10 inches, 190.5 x 254 mm |
|
QPageSize.Folio |
210 x 330 mm |
|
QPageSize.Ledger |
431.8 x 279.4 mm |
|
QPageSize.Legal |
8.5 x 14 inches, 215.9 x 355.6 mm |
|
QPageSize.Letter |
8.5 x 11 inches, 215.9 x 279.4 mm |
|
QPageSize.Tabloid |
279.4 x 431.8 mm |
|
QPageSize.Custom |
Unknown, or a user defined size. |
|
QPageSize.A10 |
|
|
QPageSize.A3Extra |
|
|
QPageSize.A4Extra |
|
|
QPageSize.A4Plus |
|
|
QPageSize.A4Small |
|
|
QPageSize.A5Extra |
|
|
QPageSize.B5Extra |
|
|
QPageSize.JisB0 |
|
|
QPageSize.JisB1 |
|
|
QPageSize.JisB2 |
|
|
QPageSize.JisB3 |
|
|
QPageSize.JisB4 |
|
|
QPageSize.JisB5 |
|
|
QPageSize.JisB6 |
, |
|
QPageSize.JisB7 |
|
|
QPageSize.JisB8 |
|
|
QPageSize.JisB9 |
|
|
QPageSize.JisB10 |
|
|
QPageSize.AnsiA |
= Letter |
|
QPageSize.AnsiB |
= Ledger |
|
QPageSize.AnsiC |
|
|
QPageSize.AnsiD |
|
|
QPageSize.AnsiE |
|
|
QPageSize.LegalExtra |
|
|
QPageSize.LetterExtra |
|
|
QPageSize.LetterPlus |
|
|
QPageSize.LetterSmall |
|
|
QPageSize.TabloidExtra |
|
|
QPageSize.ArchA |
|
|
QPageSize.ArchB |
|
|
QPageSize.ArchC |
|
|
QPageSize.ArchD |
|
|
QPageSize.ArchE |
|
|
QPageSize.Imperial7x9 |
|
|
QPageSize.Imperial8x10 |
|
|
QPageSize.Imperial9x11 |
|
|
QPageSize.Imperial9x12 |
|
|
QPageSize.Imperial10x11 |
|
|
QPageSize.Imperial10x13 |
|
|
QPageSize.Imperial10x14 |
|
|
QPageSize.Imperial12x11 |
|
|
QPageSize.Imperial15x11 |
|
|
QPageSize.ExecutiveStandard |
|
|
QPageSize.Note |
|
|
QPageSize.Quarto |
|
|
QPageSize.Statement |
|
|
QPageSize.SuperA |
|
|
QPageSize.SuperB |
|
|
QPageSize.Postcard |
|
|
QPageSize.DoublePostcard |
|
|
QPageSize.Prc16K |
|
|
QPageSize.Prc32K |
|
|
QPageSize.Prc32KBig |
|
|
QPageSize.FanFoldUS |
|
|
QPageSize.FanFoldGerman |
|
|
QPageSize.FanFoldGermanLegal |
|
|
QPageSize.EnvelopeB4 |
|
|
QPageSize.EnvelopeB5 |
|
|
QPageSize.EnvelopeB6 |
|
|
QPageSize.EnvelopeC0 |
|
|
QPageSize.EnvelopeC1 |
|
|
QPageSize.EnvelopeC2 |
|
|
QPageSize.EnvelopeC3 |
|
|
QPageSize.EnvelopeC4 |
|
|
QPageSize.EnvelopeC5 |
= C5E |
|
QPageSize.EnvelopeC6 |
|
|
QPageSize.EnvelopeC65 |
|
|
QPageSize.EnvelopeC7 |
|
|
QPageSize.EnvelopeDL |
= DLE |
|
QPageSize.Envelope9 |
|
|
QPageSize.Envelope10 |
= |
|
QPageSize.Envelope11 |
|
|
QPageSize.Envelope12 |
|
|
QPageSize.Envelope14 |
|
|
QPageSize.EnvelopeMonarch |
|
|
QPageSize.EnvelopePersonal |
|
|
QPageSize.EnvelopeChou3 |
|
|
QPageSize.EnvelopeChou4 |
|
|
QPageSize.EnvelopeInvite |
|
|
QPageSize.EnvelopeItalian |
|
|
QPageSize.EnvelopeKaku2 |
|
|
QPageSize.EnvelopeKaku3 |
|
|
QPageSize.EnvelopePrc1 |
|
|
QPageSize.EnvelopePrc2 |
|
|
QPageSize.EnvelopePrc3 |
|
|
QPageSize.EnvelopePrc4 |
|
|
QPageSize.EnvelopePrc5 |
|
|
QPageSize.EnvelopePrc6 |
|
|
QPageSize.EnvelopePrc7 |
|
|
QPageSize.EnvelopePrc8 |
|
|
QPageSize.EnvelopePrc9 |
|
|
QPageSize.EnvelopePrc10 |
|
|
QPageSize.EnvelopeYou4 |
|
|
QPageSize.LastPageSize |
= |
Due to historic reasons is not the same as the standard Postscript and Windows Executive size, use instead.
The Postscript standard size is different to the Windows DMPAPER_FOLIO size, use the Postscript standard size if needed.
PySide2.QtGui.QPageSize.
Unit
¶
This enum type is used to specify the measurement unit for page sizes.
|
常量 |
描述 |
|---|---|
|
QPageSize.Millimeter |
|
|
QPageSize.Point |
1/72th of an inch |
|
QPageSize.Inch |
|
|
QPageSize.Pica |
1/72th of a foot, 1/6th of an inch, 12 Points |
|
QPageSize.Didot |
1/72th of a French inch, 0.375 mm |
|
QPageSize.Cicero |
1/6th of a French inch, 12 Didot, 4.5mm |
PySide2.QtGui.QPageSize.
SizeMatchPolicy
¶
|
常量 |
描述 |
|---|---|
|
QPageSize.FuzzyMatch |
Match to a standard page size if within the margin of tolerance. |
|
QPageSize.FuzzyOrientationMatch |
Match to a standard page size if within the margin of tolerance regardless of orientation. |
|
QPageSize.ExactMatch |
Only match to a standard page size if the sizes match exactly. |
PySide2.QtGui.QPageSize.
definitionSize
(
)
¶
QSizeF
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.
若
QPageSize
is invalid then the
QSizeF
will be invalid.
另请参阅
PySide2.QtGui.QPageSize.
definitionSize
(
pageSizeId
)
¶
pageSizeId
–
PageSizeId
QSizeF
Returns the definition size of the standard
pageSizeId
.
To obtain the definition units, call
definitionUnits()
.
PySide2.QtGui.QPageSize.
definitionUnits
(
)
¶
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.
若
QPageSize
is invalid then the
Unit
will be invalid.
另请参阅
PySide2.QtGui.QPageSize.
definitionUnits
(
pageSizeId
)
¶
pageSizeId
–
PageSizeId
Returns the definition units of the standard
pageSizeId
.
To obtain the definition size, call
definitionSize()
.
PySide2.QtGui.QPageSize.
id
(
)
¶
Returns the standard
PageSizeId
of the page, or
自定义
.
若
QPageSize
is invalid then the ID will be
自定义
.
PySide2.QtGui.QPageSize.
id
(
pointSize
[
,
matchPolicy=FuzzyMatch
]
)
¶
pointSize
–
QSize
matchPolicy
–
SizeMatchPolicy
Returns the standard
PageSizeId
为给定
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
sizePoints()
using the returned
PageSizeId
to find out the actual point size of the
PageSizeId
before using it in any calculations.
PySide2.QtGui.QPageSize.
id
(
size
,
units
[
,
matchPolicy=FuzzyMatch
]
)
¶
size
–
QSizeF
units
–
Unit
matchPolicy
–
SizeMatchPolicy
Returns the standard
PageSizeId
为给定
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
size()
using the returned
PageSizeId
to find out the actual unit size of the
PageSizeId
before using it in any calculations.
PySide2.QtGui.QPageSize.
id
(
windowsId
)
¶
windowsId
–
int
返回
PageSizeId
for the given Windows DMPAPER enum value
windowsId
.
If there is no matching
PageSizeId
then
自定义
被返回。
PySide2.QtGui.QPageSize.
isEquivalentTo
(
other
)
¶
other
–
QPageSize
bool
返回
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.
PySide2.QtGui.QPageSize.
isValid
(
)
¶
bool
返回
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.
PySide2.QtGui.QPageSize.
key
(
)
¶
unicode
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.
若
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()
.
另请参阅
PySide2.QtGui.QPageSize.
key
(
pageSizeId
)
¶
pageSizeId
–
PageSizeId
unicode
Returns the PPD mediaOption keyword of the standard
pageSizeId
.
若
QPageSize
is invalid then the key will be empty.
PySide2.QtGui.QPageSize.
name
(
)
¶
unicode
Returns a localized human-readable name for the page size.
若
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.
若
QPageSize
is invalid then the name will be an empty string.
PySide2.QtGui.QPageSize.
name
(
pageSizeId
)
¶
pageSizeId
–
PageSizeId
unicode
Returns the localized name of the standard
pageSizeId
.
若
QPageSize
is invalid then the name will be empty.
PySide2.QtGui.QPageSize.
rect
(
units
)
¶
units
–
Unit
QRectF
Returns the page rectangle in the required
units
.
PySide2.QtGui.QPageSize.
rectPixels
(
resolution
)
¶
resolution
–
int
QRect
Returns the page rectangle in Device Pixels at the given
resolution
.
PySide2.QtGui.QPageSize.
rectPoints
(
)
¶
QRect
Returns the page rectangle in Postscript Points (1/72 of an inch).
PySide2.QtGui.QPageSize.
size
(
pageSizeId
,
units
)
¶
pageSizeId
–
PageSizeId
units
–
Unit
QSizeF
Returns the size of the standard
pageSizeId
in the requested
units
.
PySide2.QtGui.QPageSize.
size
(
units
)
¶
units
–
Unit
QSizeF
Returns the size of the page in the required
units
.
PySide2.QtGui.QPageSize.
sizePixels
(
pageSizeId
,
resolution
)
¶
pageSizeId
–
PageSizeId
resolution
–
int
QSize
Returns the size of the standard
pageSizeId
in Device Pixels for the given
resolution
.
PySide2.QtGui.QPageSize.
sizePixels
(
resolution
)
¶
resolution
–
int
QSize
Returns the size of the page in Device Pixels at the given
resolution
.
PySide2.QtGui.QPageSize.
sizePoints
(
)
¶
QSize
Returns the size of the page in Postscript Points (1/72 of an inch).
PySide2.QtGui.QPageSize.
sizePoints
(
pageSizeId
)
¶
pageSizeId
–
PageSizeId
QSize
Returns the size of the standard
pageSizeId
in Points.
PySide2.QtGui.QPageSize.
swap
(
other
)
¶
other
–
QPageSize
交换此
QPageSize
with
other
。此函数非常快,且从不失败。
PySide2.QtGui.QPageSize.
windowsId
(
)
¶
int
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.
若
QPageSize
is invalid then the Windows ID will be 0.
另请参阅
PySide2.QtGui.QPageSize.
windowsId
(
pageSizeId
)
¶
pageSizeId
–
PageSizeId
int
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.