7#include <QtCore/qpoint.h>
8#include <QtCore/qrect.h>
9#include <QtCore/qsize.h>
45 if (fromUnits == toUnits || margins.
isNull())
52 qCeil(margins.
top() * multiplierX100) / 100.0,
53 qCeil(margins.
right() * multiplierX100) / 100.0,
62 return QMarginsF(
qRound(pointMargins.left() * 100 / multiplier) / 100.0,
63 qRound(pointMargins.top() * 100 / multiplier) / 100.0,
64 qRound(pointMargins.right() * 100 / multiplier) / 100.0,
65 qRound(pointMargins.bottom() * 100 / multiplier) / 100.0);
123 m_fullSize = fullSizeUnits(m_units);
133 return m_pageSize ==
other.m_pageSize
134 && m_orientation ==
other.m_orientation
135 && m_units ==
other.m_units
136 && m_margins ==
other.m_margins
137 && m_minMargins ==
other.m_minMargins
138 && m_maxMargins ==
other.m_maxMargins;
144 && m_orientation ==
other.m_orientation
179 m_minMargins = minMargins;
475 d->m_fullSize = d->fullSizeUnits(d->m_units);
489 return d->m_pageSize;
504 d->m_fullSize = d->fullSizeUnits(d->m_units);
507 d->m_maxMargins.
setLeft(d->m_maxMargins.
left() + change);
509 d->m_maxMargins.
setTop(d->m_maxMargins.
top() - change);
520 return d->m_orientation;
529 if (
units != d->m_units) {
535 d->m_fullSize = d->fullSizeUnits(d->m_units);
573 if (clampedMargins != d->m_margins) {
575 d->m_margins = clampedMargins;
614 leftMargin =
qBound(d->m_minMargins.
left(), leftMargin, d->m_maxMargins.
left());
620 || (leftMargin >= d->m_minMargins.
left() && leftMargin <= d->m_maxMargins.left())) {
622 d->m_margins.
setLeft(leftMargin);
645 rightMargin =
qBound(d->m_minMargins.
right(), rightMargin, d->m_maxMargins.
right());
651 || (rightMargin >= d->m_minMargins.
right() && rightMargin <= d->m_maxMargins.right())) {
676 topMargin =
qBound(d->m_minMargins.
top(), topMargin, d->m_maxMargins.
top());
682 || (topMargin >= d->m_minMargins.
top() && topMargin <= d->m_maxMargins.top())) {
684 d->m_margins.
setTop(topMargin);
707 bottomMargin =
qBound(d->m_minMargins.
bottom(), bottomMargin, d->m_maxMargins.
bottom());
713 || (bottomMargin >= d->m_minMargins.
bottom() && bottomMargin <= d->m_maxMargins.bottom())) {
793 return d->m_minMargins;
810 return d->m_maxMargins;
898 if (
units == d->m_units)
940#ifndef QT_NO_DEBUG_STREAM
946 dbg <<
"QPageLayout(";
949 dbg <<
'"' <<
layout.pageSize().name() <<
"\", "
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
constexpr qreal right() const noexcept
Returns the right margin.
constexpr qreal left() const noexcept
Returns the left margin.
constexpr qreal top() const noexcept
Returns the top margin.
constexpr void setLeft(qreal aleft) noexcept
Sets the left margin to aleft (which must be finite).
constexpr bool isNull() const noexcept
Returns true if all margins are very close to 0; otherwise returns false.
constexpr QMargins toMargins() const noexcept
Returns an integer-based copy of this margins object.
constexpr void setRight(qreal aright) noexcept
Sets the right margin to aright (which must be finite).
constexpr void setBottom(qreal abottom) noexcept
Sets the bottom margin to abottom (which must be finite).
constexpr void setTop(qreal atop) noexcept
Sets the top margin to atop (which must be finite).
constexpr qreal bottom() const noexcept
Returns the bottom margin.
bool isEquivalentTo(const QPageLayoutPrivate &other) const
bool operator==(const QPageLayoutPrivate &other) const
void setDefaultMargins(const QMarginsF &minMargins)
QMargins marginsPixels(int resolution) const
QRect fullRectPixels(int resolution) const
QRect fullRectPoints() const
QMarginsF margins(QPageLayout::Unit units) const
QMarginsF marginsPoints() const
QPageLayoutPrivate(const QPageSize &pageSize, QPageLayout::Orientation orientation, const QMarginsF &margins, QPageLayout::Unit units, const QMarginsF &minMargins)
QMarginsF clampMargins(const QMarginsF &margins) const
QRect paintRectPoints() const
Returns the paintable rectangle in rounded Postscript Points (1/72 of an inch).
QMargins marginsPoints() const
Returns the margins of the page layout in Postscript Points (1/72 of an inch).
QMarginsF minimumMargins() const
Returns the minimum margins of the page layout.
void setOrientation(Orientation orientation)
Sets the page orientation of the page layout to orientation.
QRect fullRectPoints() const
Returns the full page rectangle in Postscript Points (1/72 of an inch).
Mode mode() const
Returns the page layout mode.
QRectF fullRect() const
Returns the full page rectangle in the current layout units.
bool isEquivalentTo(const QPageLayout &other) const
Returns true if this page layout is equivalent to the other page layout, i.e.
void setMinimumMargins(const QMarginsF &minMargins)
Sets the minimum page margins of the page layout to minMargins.
void setUnits(Unit units)
Sets the units used to define the page layout.
bool setTopMargin(qreal topMargin, OutOfBoundsPolicy outOfBoundsPolicy=OutOfBoundsPolicy::Reject)
Sets the top page margin of the page layout to topMargin.
Unit units() const
Returns the units the page layout is currently defined in.
bool setRightMargin(qreal rightMargin, OutOfBoundsPolicy outOfBoundsPolicy=OutOfBoundsPolicy::Reject)
Sets the right page margin of the page layout to rightMargin.
bool isValid() const
Returns true if this page layout is valid.
QMargins marginsPixels(int resolution) const
Returns the margins of the page layout in device pixels for the given resolution.
QRectF paintRect() const
Returns the page rectangle in the current layout units.
Unit
This enum type is used to specify the measurement unit for page layout and margins.
QPageLayout()
Creates an invalid QPageLayout.
QMarginsF margins() const
Returns the margins of the page layout using the currently set units.
Mode
Defines the page layout mode.
QPageLayout & operator=(const QPageLayout &other)
Assignment operator, assigns other to this.
bool setBottomMargin(qreal bottomMargin, OutOfBoundsPolicy outOfBoundsPolicy=OutOfBoundsPolicy::Reject)
Sets the bottom page margin of the page layout to bottomMargin.
Orientation orientation() const
Returns the page orientation of the page layout.
~QPageLayout()
Destroys the page layout.
QMarginsF maximumMargins() const
Returns the maximum margins that would be applied if the page layout was in StandardMode.
bool setLeftMargin(qreal leftMargin, OutOfBoundsPolicy outOfBoundsPolicy=OutOfBoundsPolicy::Reject)
Sets the left page margin of the page layout to leftMargin.
bool setMargins(const QMarginsF &margins, OutOfBoundsPolicy outOfBoundsPolicy=OutOfBoundsPolicy::Reject)
Sets the page margins of the page layout to margins.
QRect paintRectPixels(int resolution) const
Returns the paintable rectangle in rounded device pixels for the given resolution.
void setPageSize(const QPageSize &pageSize, const QMarginsF &minMargins=QMarginsF(0, 0, 0, 0))
Sets the page size of the page layout to pageSize.
Orientation
This enum type defines the page orientation.
QRect fullRectPixels(int resolution) const
Returns the full page rectangle in device pixels for the given resolution.
void setMode(Mode mode)
Sets a page layout mode to mode.
QPageSize pageSize() const
Returns the page size of the page layout.
bool isValid() const
Returns true if this page size is valid.
Unit
This enum type is used to specify the measurement unit for page sizes.
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.
bool isEquivalentTo(const QPageSize &other) const
Returns true if this page is equivalent to the other page, i.e.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
constexpr QSize transposed() const noexcept
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
int qRound(qfloat16 d) noexcept
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
Q_GUI_EXPORT QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)
qreal qt_pixelMultiplier(int resolution)
QDebug operator<<(QDebug dbg, const QPageLayout &layout)
QT_BEGIN_NAMESPACE Q_GUI_EXPORT qreal qt_pointMultiplier(QPageLayout::Unit unit)