QPageLayout Class
ページのサイズ、向き、余白を記述する。詳細...
ヘッダー | #include <QPageLayout> |
CMake.CMakeのヘッダーです: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
パブリックな型
enum | Mode { StandardMode, FullPageMode } |
enum | Orientation { Portrait, Landscape } |
(since 6.8) enum class | OutOfBoundsPolicy { Reject, Clamp } |
enum | Unit { Millimeter, Point, Inch, Pica, Didot, Cicero } |
パブリック関数
QPageLayout() | |
QPageLayout(const QPageSize &pageSize, QPageLayout::Orientation orientation, const QMarginsF &margins, QPageLayout::Unit units = Point, const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0)) | |
QPageLayout(const QPageLayout &other) | |
~QPageLayout() | |
QRectF | fullRect() const |
QRectF | fullRect(QPageLayout::Unit units) const |
QRect | fullRectPixels(int resolution) const |
QRect | fullRectPoints() const |
bool | isEquivalentTo(const QPageLayout &other) const |
bool | isValid() const |
QMarginsF | margins() const |
QMarginsF | margins(QPageLayout::Unit units) const |
QMargins | marginsPixels(int resolution) const |
QMargins | marginsPoints() const |
QMarginsF | maximumMargins() const |
QMarginsF | minimumMargins() const |
QPageLayout::Mode | mode() const |
QPageLayout::Orientation | orientation() const |
QPageSize | pageSize() const |
QRectF | paintRect() const |
QRectF | paintRect(QPageLayout::Unit units) const |
QRect | paintRectPixels(int resolution) const |
QRect | paintRectPoints() const |
bool | setBottomMargin(qreal bottomMargin, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject) |
bool | setLeftMargin(qreal leftMargin, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject) |
bool | setMargins(const QMarginsF &margins, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject) |
void | setMinimumMargins(const QMarginsF &minMargins) |
void | setMode(QPageLayout::Mode mode) |
void | setOrientation(QPageLayout::Orientation orientation) |
void | setPageSize(const QPageSize &pageSize, const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0)) |
bool | setRightMargin(qreal rightMargin, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject) |
bool | setTopMargin(qreal topMargin, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject) |
void | setUnits(QPageLayout::Unit units) |
void | swap(QPageLayout &other) |
QPageLayout::Unit | units() const |
QPageLayout & | operator=(QPageLayout &&other) |
QPageLayout & | operator=(const QPageLayout &other) |
関連する非メンバー
bool | operator!=(const QPageLayout &lhs, const QPageLayout &rhs) |
bool | operator==(const QPageLayout &lhs, const QPageLayout &rhs) |
詳細な説明
QPageLayoutクラスは、ページングされたドキュメントにおけるページのレイアウトを定義し、ページサイズ、向き、余白を設定することができ、これらの属性によって定義されたフルページとペイント可能なページの矩形を様々な単位で照会することができます。
ページ・サイズはQPageSize クラスで定義され、ページ・サイズ属性を問い合わせることができます。QPageSize 自体は常に縦向きで定義されることに注意してください。
Qt の Print サポートと組み合わせて使用する場合、最小余白はプリンタによって定義された印刷可能な最小領域を反映します。
デフォルトのStandardMode では、現在のマージンと最小マージンが常に考慮されます。描画可能な矩形は、全ページの矩形から現在の余白を引いたものであり、現在の余白は、全ページのサイズで許容される最小の余白と最大の余白の間の値にのみ設定できます。
FullPageMode では、 カ レ ン ト 余白 と 最小余白は考慮 さ れません。描画可能な矩形は全ページの矩形であ り 、 カ レ ン ト 余白は、 最小余白 と ページサ イ ズにかかわ ら ず、 任意の値に設定す る こ と がで き ます。
QPageSizeも参照 。
メンバ型ドキュメント
enum QPageLayout::Mode
ページレイアウトモードを定義します。
定数 | 値 | 説明 |
---|---|---|
QPageLayout::StandardMode | 0 | Paint Rect は余白を含み、余白は最小値と最大値の間になければなりません。 |
QPageLayout::FullPageMode | 1 | Paint Rect は余白を除外し、余白はどのような値でもよく、手動で管理しなければならない。 |
StandardModeでは、余白を設定するとき、Clamp を使用して、余白が許容される最小値と最大値の間に収まるように自動的にクランプします。
OutOfBoundsPolicyも参照してください 。
enum QPageLayout::Orientation
この列挙型はページの向きを定義する。
定数 | 値 | 説明 |
---|---|---|
QPageLayout::Portrait | 0 | ページサイズはデフォルトの向きで使用される |
QPageLayout::Landscape | 1 | ページサイズは90度回転されます。 |
いくつかの標準ページサイズは、幅が高さよりも大きく定義されていることに注意してください。
[since 6.8]
enum class QPageLayout::OutOfBoundsPolicy
範囲外のマージンに対するポリシーを定義します。
定数 | 値 | 説明 |
---|---|---|
QPageLayout::OutOfBoundsPolicy::Reject | 0 | マージンは、最小値と最大値の範囲内になければなりません。 |
QPageLayout::OutOfBoundsPolicy::Clamp | 1 | マージンは、それらが有効であることを保証するために、最小値と最大値の間でクランプされる。 |
注意: このポリシーは、すべてのマージンが受け入れられるFullPageMode では効果がありません。
この enum は Qt 6.8 で導入されました。
enum QPageLayout::Unit
この列挙型は、ページレイアウトと余白の測定単位を指定するのに使われる。
定数 | 値 | 説明 |
---|---|---|
QPageLayout::Millimeter | 0 | |
QPageLayout::Point | 1 | 1/72インチ |
QPageLayout::Inch | 2 | |
QPageLayout::Pica | 3 | 1/72フィート、1/6インチ、12ポイント |
QPageLayout::Didot | 4 | 1/72仏インチ、0.375mm |
QPageLayout::Cicero | 5 | 1/6仏インチ、12ディド、4.5mm |
メンバー関数ドキュメント
QPageLayout::QPageLayout()
無効なQPageLayoutを作成します。
QPageLayout::QPageLayout(const QPageSize &pageSize, QPageLayout::Orientation orientation, const QMarginsF &margins, QPageLayout::Unit units = Point, const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0))
与えられたpageSize 、orientation 、margins を持つ QPageLayout を、与えられたunits に作成します。
minMargins例えば、物理的な印刷デバイスで印刷できる最小の余白です。
構築されたQPageLayoutはStandardMode 。
与えられたmargins は、ページサイズで許容される最小余白と最大余白にクランプされます。
QPageLayout::QPageLayout(const QPageLayout &other)
コピーコンストラクタ。other をこのコンストラクタにコピーする。
[noexcept]
QPageLayout::~QPageLayout()
ページレイアウトを破壊する。
QRectF QPageLayout::fullRect() const
カ レ ン ト レ イ ア ウ ト 単位で、 ページ全体の矩形を返 し ます。
こ のページ矩形は、 ページサ イ ズ と ページの向 き を考慮 し ますが、 ページ余白は考慮 し ません。
QRectF QPageLayout::fullRect(QPageLayout::Unit units) const
ページ全体の矩形を、 必要なunits で返 し ます。
こ のページ矩形は、 ページサ イ ズ と ページの向 き を考慮 し ますが、 ページ余白は考慮 し ません。
paintRect()も参照 。
QRect QPageLayout::fullRectPixels(int resolution) const
ページ全体の矩形を、 与えられたresolution に対するデバイスピクセル単位で返します。
ページ矩形は、ページサイズとページの向きを考慮しますが、ページの余白は考慮しません。
paintRect()も参照 。
QRect QPageLayout::fullRectPoints() const
全ページの矩形をポストスクリプトポイント(1/72インチ)で返す。
ページの矩形は、ページサイズとページの向きを考慮しますが、ページの余白は考慮しません。
paintRect()も参照 。
bool QPageLayout::isEquivalentTo(const QPageLayout &other) const
こ のページ レ イ ア ウ ト がother ページ レ イ ア ウ ト と 等価であ る 場合、 すなわちページのサ イ ズ ・ 余白 ・ 向 き が同 じ 場合、true
を返す。
bool QPageLayout::isValid() const
このページレイアウトが有効な場合はtrue
を返す。
QMarginsF QPageLayout::margins() const
ページレイアウトの余白を、現在設定されている単位で返します。
setMargins() およびunits()も参照 ください。
QMarginsF QPageLayout::margins(QPageLayout::Unit units) const
ページレイアウトの余白を、要求されたunits を用いて返します。
setMargins() およびmargins()も参照 。
QMargins QPageLayout::marginsPixels(int resolution) const
ページレイアウトの余白を、与えられたresolution に対するデバイスピクセル単位で返します。
setMargins()も参照 。
QMargins QPageLayout::marginsPoints() const
ページレイアウトの余白をポストスクリプトポイント (1/72 インチ) で返す。
setMargins() およびmargins()も参照 。
QMarginsF QPageLayout::maximumMargins() const
ページレイアウトがStandardMode の場合に適用される最大余白を返します。
許容される最大マージンは、ページの全サイズから設定された最小マージンを引いたものとして計算されます。たとえば、ページ幅が100ポイントで右マージンの最小値が10ポイントの場合、左マージンの最大値は90ポイントとなります。
setMinimumMargins() およびminimumMargins()も参照 。
QMarginsF QPageLayout::minimumMargins() const
ページレイアウトの最小マージンを返します。
setMinimumMargins() およびmaximumMargins()も参照 ください。
QPageLayout::Mode QPageLayout::mode() const
ページレイアウトモードを返します。
setMode()も参照 。
QPageLayout::Orientation QPageLayout::orientation() const
ページレイアウトのページ方向を返します。
setOrientation()も参照 ください。
QPageSize QPageLayout::pageSize() const
ページレイアウトのページサイズを返します。
QPageSize は常に縦向きで定義されていることに注意してください。設定された向きを考慮したサイズを取得するには、fullRect() を使用する必要があります。
setPageSize()も参照 。
QRectF QPageLayout::paintRect() const
ページ矩形を現在のレイアウト単位で返します。
塗 り 込み可能な矩形は、 ページサ イ ズ ・ 向 き ・ 余白を考慮 し た も のです。
FullPageMode モー ド が設定 さ れてい る と き は、fullRect() が返 さ れ、 余白は手動で管理す る 必要があ り ます。
QRectF QPageLayout::paintRect(QPageLayout::Unit units) const
ページ矩形を、 必要なunits で返 し ます。
塗 り 込み可能な矩形は、 ページサ イ ズ ・ 向 き ・ 余白を考慮 し た も のです。
FullPageMode モー ド が設定 さ れてい る と き は、fullRect() が返 さ れ、 余白は手動で管理す る 必要があ り ます。
QRect QPageLayout::paintRectPixels(int resolution) const
描画可能な矩形を、 与えられたresolution に対する丸めたデバイスピクセル単位で返します。
塗 り 込み可能な矩形は、 ページサ イ ズ ・ 向 き ・ 余白を考慮 し ます。
FullPageMode モー ド が設定 さ れてい る と き は、fullRect() が返 さ れ、 余白は手動で管理す る 必要があ り ます。
QRect QPageLayout::paintRectPoints() const
描画可能な矩形を丸めたポストスクリプトポイント(1/72インチ)で返します。
描画可能な矩形は、ページサイズ、向き、余白を考慮する。
FullPageMode モー ド が設定 さ れてい る と き は、fullRect() が返 さ れ、 余白は手動で管理す る 必要があ り ます。
bool QPageLayout::setBottomMargin(qreal bottomMargin, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject)
ページレイアウトの最下部のページマージンをbottomMargin に設定します。マージンが正常に設定された場合はtrueを返します。
使用される単位は、レイアウトで現在定義されている単位です。異なる単位を使用するには、まずsetUnits() を呼び出します。
Qt 6.8 以降では、オプションのoutOfBoundsPolicy を使用して、範囲外のマージンの処理方法を指定できます。
setMargins() およびmargins()も参照してください 。
bool QPageLayout::setLeftMargin(qreal leftMargin, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject)
ページレイアウトの左ページマージンをleftMargin に設定します。マージンが正常に設定された場合はtrueを返します。
使用される単位は、レイアウトで現在定義されている単位です。異なる単位を使用するには、まずsetUnits() を呼び出します。
Qt 6.8 以降では、オプションのoutOfBoundsPolicy を使用して、範囲外のマージンの処理方法を指定できます。
setMargins() およびmargins()も参照してください 。
bool QPageLayout::setMargins(const QMarginsF &margins, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject)
ページレイアウトのページマージンをmargins に設定します。余白が正常に設定された場合はtrueを返します。
使用される単位は、レイアウトで現在定義されている単位です。異なる単位を使用するには、最初にsetUnits() を呼び出します。
Qt 6.8 以降では、オプションのoutOfBoundsPolicy を使用して、範囲外の余白の処理方法を指定できます。
margins() およびunits()も参照してください 。
void QPageLayout::setMinimumMargins(const QMarginsF &minMargins)
ページレイアウトの最小ページマージンをminMargins に設定する。
ページサイズに設定されたデフォルト値を上書きすることは推奨されません。これは、物理的な印刷デバイスの最小印刷可能領域である可能性があるからです。
StandardMode モー ド が設定 さ れてい る と き は、 既存の余白は新しいminMargins と ページサ イ ズで許 さ れ る 最大値に合わせ ら れます。FullPageMode が設定されている場合、既存の余白は変更されない。
minimumMargins() およびsetMargins()も参照のこと 。
void QPageLayout::setMode(QPageLayout::Mode mode)
ページレイアウトモードをmode に設定する。
mode()も参照 。
void QPageLayout::setOrientation(QPageLayout::Orientation orientation)
ページレイアウトのページ方向をorientation に設定する。
向きを変更しても、現在のマージンや最小マージンには影響しません。
orientation()も参照 。
void QPageLayout::setPageSize(const QPageSize &pageSize, const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0))
ページレイアウトのページサイズをpageSize に設定します。
オプシ ョ ンで、 許容余白の最小値minMargins を定義 し ます。 た と えば、 物理的な印刷デバ イ ス で印刷で き る 余白の最小値。 そ う でなければ、 最小余白のデフ ォ ル ト 値は 0 にな り ます。
StandardMode が設定されている場合、既存の余白は、新しい最小余白とページサイズで許容される最大余白にクランプされます。FullPageMode が設定されている場合、既存の余白は変更されない。
pageSize()も参照のこと 。
bool QPageLayout::setRightMargin(qreal rightMargin, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject)
ページレイアウトの右ページマージンをrightMargin に設定します。マージンが正常に設定された場合はtrueを返します。
使用される単位は、レイアウトで現在定義されている単位です。異なる単位を使用するには、まずsetUnits() を呼び出します。
Qt 6.8 以降では、オプションのoutOfBoundsPolicy を使用して、範囲外のマージンをどのように処理するかを指定できます。
setMargins() およびmargins()も参照してください 。
bool QPageLayout::setTopMargin(qreal topMargin, QPageLayout::OutOfBoundsPolicy outOfBoundsPolicy = OutOfBoundsPolicy::Reject)
ページレイアウトの上ページマージンをtopMargin に設定します。マージンが正常に設定された場合はtrueを返します。
使用される単位は、レイアウトで現在定義されている単位です。異なる単位を使用するには、まずsetUnits() を呼び出します。
Qt 6.8 以降では、オプションのoutOfBoundsPolicy を使用して、範囲外のマージンの処理方法を指定できます。
setMargins() およびmargins()も参照してください 。
void QPageLayout::setUnits(QPageLayout::Unit units)
ページレイアウトの定義に使用するunits を設定します。
units()も参照してください 。
[noexcept]
void QPageLayout::swap(QPageLayout &other)
このページレイアウトをother と入れ替える。この操作は非常に速く、失敗することはない。
QPageLayout::Unit QPageLayout::units() const
ページレイアウトが現在定義されている単位を返します。
setUnits()も参照 ください。
[noexcept]
QPageLayout &QPageLayout::operator=(QPageLayout &&other)
Move-このQPageLayout インスタンスにother を割り当て、管理ポインタの所有権をこのインスタンスに移す。
QPageLayout &QPageLayout::operator=(const QPageLayout &other)
代入演算子。other を代入する。
関連する非会員
bool operator!=(const QPageLayout &lhs, const QPageLayout &rhs)
ページレイアウトlhs がページレイアウトrhs と等しくない場合、すなわち属性が異なる場合、true
を返します。
特に、QPageSize ID、名前、サイズが正確に一致しなければならないページサイズと、単位が一致しなければならない余白については、これは厳密な等値であることに注意してください。
QPageLayout::isEquivalentTo()も参照してください 。
bool operator==(const QPageLayout &lhs, const QPageLayout &rhs)
ページレイアウトlhs がページレイアウトrhs と等しい場合、すなわちすべての属性が正確に等しい場合、true
を返します。
特に、QPageSize ID、名前、サイズが正確に一致しなければならないページサイズと、単位が一致しなければならない余白については、これは厳密な等値であることに注意してください。
QPageLayout::isEquivalentTo()も参照してください 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.