[][src]Struct qt_gui::QPageSize

#[repr(C)]pub struct QPageSize { /* fields omitted */ }

The QPageSize class describes the size and name of a defined page size

C++ class: QPageSize.

C++ documentation:

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.

Methods

impl QPageSize[src]

pub unsafe fn copy_from(
    &self,
    other: impl CastInto<Ref<QPageSize>>
) -> Ref<QPageSize>
[src]

Assignment operator, assigns other to this.

Calls C++ function: QPageSize& QPageSize::operator=(const QPageSize& other).

C++ documentation:

Assignment operator, assigns other to this.

pub unsafe fn definition_size_0a(&self) -> CppBox<QSizeF>[src]

Returns the definition size of the page size.

Calls C++ function: QSizeF QPageSize::definitionSize() const.

C++ documentation:

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.

See also definitionUnits().

pub unsafe fn definition_size_1a(page_size_id: PageSizeId) -> CppBox<QSizeF>[src]

Returns the definition size of the standard pageSizeId.

Calls C++ function: static QSizeF QPageSize::definitionSize(QPageSize::PageSizeId pageSizeId).

C++ documentation:

Returns the definition size of the standard pageSizeId.

To obtain the definition units, call QPageSize::definitionUnits().

pub unsafe fn definition_units_0a(&self) -> Unit[src]

Returns the definition units of the page size.

Calls C++ function: QPageSize::Unit QPageSize::definitionUnits() const.

C++ documentation:

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.

See also definitionSize().

pub unsafe fn definition_units_1a(page_size_id: PageSizeId) -> Unit[src]

Returns the definition units of the standard pageSizeId.

Calls C++ function: static QPageSize::Unit QPageSize::definitionUnits(QPageSize::PageSizeId pageSizeId).

C++ documentation:

Returns the definition units of the standard pageSizeId.

To obtain the definition size, call QPageSize::definitionSize().

pub unsafe fn id(&self) -> PageSizeId[src]

Returns the standard QPageSize::PageSizeId of the page, or QPageSize::Custom.

Calls C++ function: QPageSize::PageSizeId QPageSize::id() const.

C++ documentation:

Returns the standard QPageSize::PageSizeId of the page, or QPageSize::Custom.

If the QPageSize is invalid then the ID will be QPageSize::Custom.

pub unsafe fn id_q_size_size_match_policy(
    point_size: impl CastInto<Ref<QSize>>,
    match_policy: SizeMatchPolicy
) -> PageSizeId
[src]

Returns the standard QPageSize::PageSizeId of the given pointSize in points using the given matchPolicy.

Calls C++ function: static QPageSize::PageSizeId QPageSize::id(const QSize& pointSize, QPageSize::SizeMatchPolicy matchPolicy = …).

C++ documentation:

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.

pub unsafe fn id_q_size_f_unit_size_match_policy(
    size: impl CastInto<Ref<QSizeF>>,
    units: Unit,
    match_policy: SizeMatchPolicy
) -> PageSizeId
[src]

Returns the standard QPageSize::PageSizeId of the given size in units using the given matchPolicy.

Calls C++ function: static QPageSize::PageSizeId QPageSize::id(const QSizeF& size, QPageSize::Unit units, QPageSize::SizeMatchPolicy matchPolicy = …).

C++ documentation:

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.

pub unsafe fn id_int(windows_id: c_int) -> PageSizeId[src]

Returns the PageSizeId for the given Windows DMPAPER enum value windowsId.

Calls C++ function: static QPageSize::PageSizeId QPageSize::id(int windowsId).

C++ documentation:

Returns the PageSizeId for the given Windows DMPAPER enum value windowsId.

If there is no matching PageSizeId then QPageSize::Custom is returned.

pub unsafe fn id_q_size(point_size: impl CastInto<Ref<QSize>>) -> PageSizeId[src]

Returns the standard QPageSize::PageSizeId of the given pointSize in points using the given matchPolicy.

Calls C++ function: static QPageSize::PageSizeId QPageSize::id(const QSize& pointSize).

C++ documentation:

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.

pub unsafe fn id_q_size_f_unit(
    size: impl CastInto<Ref<QSizeF>>,
    units: Unit
) -> PageSizeId
[src]

Returns the standard QPageSize::PageSizeId of the given size in units using the given matchPolicy.

Calls C++ function: static QPageSize::PageSizeId QPageSize::id(const QSizeF& size, QPageSize::Unit units).

C++ documentation:

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.

pub unsafe fn is_equivalent_to(
    &self,
    other: impl CastInto<Ref<QPageSize>>
) -> bool
[src]

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.

Calls C++ function: bool QPageSize::isEquivalentTo(const QPageSize& other) const.

C++ documentation:

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.

pub unsafe fn is_valid(&self) -> bool[src]

Returns true if this page size is valid.

Calls C++ function: bool QPageSize::isValid() const.

C++ documentation:

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.

pub unsafe fn key_0a(&self) -> CppBox<QString>[src]

Returns the unique key of the page size.

Calls C++ function: QString QPageSize::key() const.

C++ documentation:

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().

See also name().

pub unsafe fn key_1a(page_size_id: PageSizeId) -> CppBox<QString>[src]

Returns the PPD mediaOption keyword of the standard pageSizeId.

Calls C++ function: static QString QPageSize::key(QPageSize::PageSizeId pageSizeId).

C++ documentation:

Returns the PPD mediaOption keyword of the standard pageSizeId.

If the QPageSize is invalid then the key will be empty.

pub unsafe fn name_0a(&self) -> CppBox<QString>[src]

Returns a localized human-readable name for the page size.

Calls C++ function: QString QPageSize::name() const.

C++ documentation:

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.

pub unsafe fn name_1a(page_size_id: PageSizeId) -> CppBox<QString>[src]

Returns the localized name of the standard pageSizeId.

Calls C++ function: static QString QPageSize::name(QPageSize::PageSizeId pageSizeId).

C++ documentation:

Returns the localized name of the standard pageSizeId.

If the QPageSize is invalid then the name will be empty.

pub unsafe fn new() -> CppBox<QPageSize>[src]

Creates a null QPageSize.

Calls C++ function: [constructor] void QPageSize::QPageSize().

C++ documentation:

Creates a null QPageSize.

pub unsafe fn from_page_size_id(page_size_id: PageSizeId) -> CppBox<QPageSize>[src]

Creates a QPageSize of the standard pageSize.

Calls C++ function: [constructor] void QPageSize::QPageSize(QPageSize::PageSizeId pageSizeId).

C++ documentation:

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.

pub unsafe fn from_q_size_q_string_size_match_policy(
    point_size: impl CastInto<Ref<QSize>>,
    name: impl CastInto<Ref<QString>>,
    match_policy: SizeMatchPolicy
) -> CppBox<QPageSize>
[src]

Creates a QPageSize of the given pointSize in Points using the matching matchPolicy.

Calls C++ function: [constructor] void QPageSize::QPageSize(const QSize& pointSize, const QString& name = …, QPageSize::SizeMatchPolicy matchPolicy = …).

C++ documentation:

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.

pub unsafe fn from_q_size_f_unit_q_string_size_match_policy(
    size: impl CastInto<Ref<QSizeF>>,
    units: Unit,
    name: impl CastInto<Ref<QString>>,
    match_policy: SizeMatchPolicy
) -> CppBox<QPageSize>
[src]

Creates a custom page of the given size in units.

Calls C++ function: [constructor] void QPageSize::QPageSize(const QSizeF& size, QPageSize::Unit units, const QString& name = …, QPageSize::SizeMatchPolicy matchPolicy = …).

C++ documentation:

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.

pub unsafe fn from_q_size_q_string(
    point_size: impl CastInto<Ref<QSize>>,
    name: impl CastInto<Ref<QString>>
) -> CppBox<QPageSize>
[src]

Creates a QPageSize of the given pointSize in Points using the matching matchPolicy.

Calls C++ function: [constructor] void QPageSize::QPageSize(const QSize& pointSize, const QString& name = …).

C++ documentation:

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.

pub unsafe fn from_q_size(
    point_size: impl CastInto<Ref<QSize>>
) -> CppBox<QPageSize>
[src]

Creates a QPageSize of the given pointSize in Points using the matching matchPolicy.

Calls C++ function: [constructor] void QPageSize::QPageSize(const QSize& pointSize).

C++ documentation:

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.

pub unsafe fn from_q_size_f_unit_q_string(
    size: impl CastInto<Ref<QSizeF>>,
    units: Unit,
    name: impl CastInto<Ref<QString>>
) -> CppBox<QPageSize>
[src]

Creates a custom page of the given size in units.

Calls C++ function: [constructor] void QPageSize::QPageSize(const QSizeF& size, QPageSize::Unit units, const QString& name = …).

C++ documentation:

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.

pub unsafe fn from_q_size_f_unit(
    size: impl CastInto<Ref<QSizeF>>,
    units: Unit
) -> CppBox<QPageSize>
[src]

Creates a custom page of the given size in units.

Calls C++ function: [constructor] void QPageSize::QPageSize(const QSizeF& size, QPageSize::Unit units).

C++ documentation:

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.

pub unsafe fn new_copy(
    other: impl CastInto<Ref<QPageSize>>
) -> CppBox<QPageSize>
[src]

Copy constructor, copies other to this.

Calls C++ function: [constructor] void QPageSize::QPageSize(const QPageSize& other).

C++ documentation:

Copy constructor, copies other to this.

pub unsafe fn rect(&self, units: Unit) -> CppBox<QRectF>[src]

Returns the page rectangle in the required units.

Calls C++ function: QRectF QPageSize::rect(QPageSize::Unit units) const.

C++ documentation:

Returns the page rectangle in the required units.

If the QPageSize is invalid then the QRect will be invalid.

pub unsafe fn rect_pixels(&self, resolution: c_int) -> CppBox<QRect>[src]

Returns the page rectangle in Device Pixels at the given resolution.

Calls C++ function: QRect QPageSize::rectPixels(int resolution) const.

C++ documentation:

Returns the page rectangle in Device Pixels at the given resolution.

If the QPageSize is invalid then the QRect will be invalid.

pub unsafe fn rect_points(&self) -> CppBox<QRect>[src]

Returns the page rectangle in Postscript Points (1/72 of an inch).

Calls C++ function: QRect QPageSize::rectPoints() const.

C++ documentation:

Returns the page rectangle in Postscript Points (1/72 of an inch).

If the QPageSize is invalid then the QRect will be invalid.

pub unsafe fn size_1a(&self, units: Unit) -> CppBox<QSizeF>[src]

Returns the size of the page in the required units.

Calls C++ function: QSizeF QPageSize::size(QPageSize::Unit units) const.

C++ documentation:

Returns the size of the page in the required units.

If the QPageSize is invalid then the QSizeF will be invalid.

pub unsafe fn size_2a(page_size_id: PageSizeId, units: Unit) -> CppBox<QSizeF>[src]

Returns the size of the standard pageSizeId in the requested units.

Calls C++ function: static QSizeF QPageSize::size(QPageSize::PageSizeId pageSizeId, QPageSize::Unit units).

C++ documentation:

Returns the size of the standard pageSizeId in the requested units.

pub unsafe fn size_pixels_1a(&self, resolution: c_int) -> CppBox<QSize>[src]

Returns the size of the page in Device Pixels at the given resolution.

Calls C++ function: QSize QPageSize::sizePixels(int resolution) const.

C++ documentation:

Returns the size of the page in Device Pixels at the given resolution.

If the QPageSize is invalid then the QSize will be invalid.

pub unsafe fn size_pixels_2a(
    page_size_id: PageSizeId,
    resolution: c_int
) -> CppBox<QSize>
[src]

Returns the size of the standard pageSizeId in Device Pixels for the given resolution.

Calls C++ function: static QSize QPageSize::sizePixels(QPageSize::PageSizeId pageSizeId, int resolution).

C++ documentation:

Returns the size of the standard pageSizeId in Device Pixels for the given resolution.

pub unsafe fn size_points_0a(&self) -> CppBox<QSize>[src]

Returns the size of the page in Postscript Points (1/72 of an inch).

Calls C++ function: QSize QPageSize::sizePoints() const.

C++ documentation:

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.

pub unsafe fn size_points_1a(page_size_id: PageSizeId) -> CppBox<QSize>[src]

Returns the size of the standard pageSizeId in Points.

Calls C++ function: static QSize QPageSize::sizePoints(QPageSize::PageSizeId pageSizeId).

C++ documentation:

Returns the size of the standard pageSizeId in Points.

pub unsafe fn swap(&self, other: impl CastInto<Ref<QPageSize>>)[src]

Swaps this QPageSize with other. This function is very fast and never fails.

Calls C++ function: void QPageSize::swap(QPageSize& other).

C++ documentation:

Swaps this QPageSize with other. This function is very fast and never fails.

pub unsafe fn windows_id_0a(&self) -> c_int[src]

Returns the Windows DMPAPER enum value for the page size.

Calls C++ function: int QPageSize::windowsId() const.

C++ documentation:

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.

See also id().

pub unsafe fn windows_id_1a(page_size_id: PageSizeId) -> c_int[src]

Returns the Windows DMPAPER enum value of the standard pageSizeId.

Calls C++ function: static int QPageSize::windowsId(QPageSize::PageSizeId pageSizeId).

C++ documentation:

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.

Trait Implementations

impl CppDeletable for QPageSize[src]

unsafe fn delete(&self)[src]

Destroys the page.

Calls C++ function: [destructor] void QPageSize::~QPageSize().

C++ documentation:

Destroys the page.

impl PartialEq<Ref<QPageSize>> for QPageSize[src]

fn eq(&self, rhs: &Ref<QPageSize>) -> bool[src]

Returns true if page layout lhs is equal to page layout rhs, i.e. if all the attributes are exactly equal.

Calls C++ function: bool operator==(const QPageSize& lhs, const QPageSize& rhs).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(const QPageLayout &lhs, const QPageLayout &rhs):

Returns true if page layout lhs is equal to page layout rhs, i.e. if all the attributes are exactly equal.

Note that this is a strict equality, especially for page size where the QPageSize ID, name and size must exactly match, and the margins where the units must match.

See also QPageLayout::isEquivalentTo().

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.