![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtCore More...
#include <qmargins.h>
Public Member Functions | |
constexpr | QMarginsF () noexcept |
Constructs a margins object with all margins set to 0. | |
constexpr | QMarginsF (qreal left, qreal top, qreal right, qreal bottom) noexcept |
Constructs margins with the given left, top, right, and bottom. | |
constexpr | QMarginsF (const QMargins &margins) noexcept |
Constructs margins copied from the given margins. | |
constexpr bool | isNull () const noexcept |
Returns true if all margins are very close to 0; otherwise returns false. | |
constexpr qreal | left () const noexcept |
Returns the left margin. | |
constexpr qreal | top () const noexcept |
Returns the top margin. | |
constexpr qreal | right () const noexcept |
Returns the right margin. | |
constexpr qreal | bottom () const noexcept |
Returns the bottom margin. | |
constexpr void | setLeft (qreal aleft) noexcept |
Sets the left margin to aleft (which must be finite). | |
constexpr void | setTop (qreal atop) noexcept |
Sets the top margin to atop (which must be finite). | |
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 QMarginsF & | operator+= (const QMarginsF &margins) noexcept |
Add each component of margins to the respective component of this object and returns a reference to it. | |
constexpr QMarginsF & | operator-= (const QMarginsF &margins) noexcept |
Subtract each component of margins from the respective component of this object and returns a reference to it. | |
constexpr QMarginsF & | operator+= (qreal addend) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds the given finite addend to each component of this object and returns a reference to it. | |
constexpr QMarginsF & | operator-= (qreal subtrahend) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Subtracts the given finite subtrahend from each component of this object and returns a reference to it. | |
constexpr QMarginsF & | operator*= (qreal factor) noexcept |
Multiplies each component of this object by the given finite factor and returns a reference to this object. | |
constexpr QMarginsF & | operator/= (qreal divisor) |
Divides each component of this object by divisor and returns a reference to this object. | |
constexpr QMargins | toMargins () const noexcept |
Returns an integer-based copy of this margins object. | |
Friends | |
constexpr bool | operator== (const QMarginsF &lhs, const QMarginsF &rhs) noexcept |
Returns true if lhs and rhs are approximately equal; otherwise returns false. | |
constexpr bool | operator!= (const QMarginsF &lhs, const QMarginsF &rhs) noexcept |
Returns true if lhs and rhs are sufficiently different; otherwise returns false . | |
template<std::size_t I, typename M , std::enable_if_t<(I< 4), bool > = true, std::enable_if_t< std::is_same_v< q20::remove_cvref_t< M >, QMarginsF >, bool > = true> | |
constexpr decltype(auto) | get (M &&m) noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
const QMarginsF | operator+ (const QMarginsF &lhs, const QMarginsF &rhs) |
Returns a QMarginsF object that is the sum of the given margins, lhs and rhs; each component is added separately. | |
const QMarginsF | operator- (const QMarginsF &lhs, const QMarginsF &rhs) |
Returns a QMarginsF object that is formed by subtracting rhs from lhs; each component is subtracted separately. | |
const QMarginsF | operator+ (const QMarginsF &lhs, qreal rhs) |
Returns a QMarginsF object that is formed by adding rhs (which must be finite) to each component of lhs. | |
const QMarginsF | operator+ (qreal lhs, const QMarginsF &rhs) |
Returns a QMarginsF object that is formed by adding lhs (which must be finite) to each component of rhs. | |
const QMarginsF | operator- (const QMarginsF &lhs, qreal rhs) |
Returns a QMarginsF object that is formed by subtracting rhs (which must be finite) from each component of lhs. | |
const QMarginsF | operator* (const QMarginsF &lhs, qreal rhs) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMarginsF object that is formed by multiplying each component of the given lhs margins by finite factor rhs. | |
const QMarginsF | operator* (qreal lhs, const QMarginsF &rhs) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMarginsF object that is formed by multiplying each component of the given lhs margins by finite factor rhs. | |
const QMarginsF | operator/ (const QMarginsF &lhs, qreal rhs) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMarginsF object that is formed by dividing the components of the given lhs margins by the given rhs divisor. | |
QMarginsF | operator| (const QMarginsF &m1, const QMarginsF &m2) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMarginsF object that is formed from the maximum of each component of m2 and m1. | |
QMarginsF | operator+ (const QMarginsF &margins) |
Returns a QMargin object that is formed from all components of margins. | |
QMarginsF | operator- (const QMarginsF &margins) |
Returns a QMargin object that is formed by negating all components of margins. | |
QDataStream & | operator<< (QDataStream &stream, const QMarginsF &m) |
Writes margin m to the given stream and returns a reference to the stream. | |
QDataStream & | operator>> (QDataStream &stream, QMarginsF &m) |
Reads a margin from the given stream into margin m and returns a reference to the stream. | |
\inmodule QtCore
The QMarginsF class defines the four margins of a rectangle.
QMarginsF defines a set of four margins; left, top, right, and bottom, that describe the finite size of the borders surrounding a rectangle.
The isNull() function returns true
only if all margins are very close to zero.
QMarginsF objects can be streamed as well as compared.
Definition at line 273 of file qmargins.h.
|
inlineconstexprnoexcept |
Constructs a margins object with all margins set to 0.
Definition at line 352 of file qmargins.h.
|
inlineconstexprnoexcept |
Constructs margins with the given left, top, right, and bottom.
All parameters must be finite.
Definition at line 355 of file qmargins.h.
|
inlineconstexprnoexcept |
Constructs margins copied from the given margins.
Definition at line 358 of file qmargins.h.
|
inlineconstexprnoexcept |
Returns the bottom margin.
Definition at line 373 of file qmargins.h.
Referenced by QPageLayoutPrivate::clampMargins(), QWindowsVistaStyle::drawControl(), QQuickLayout::effectiveSizeHints_helper(), QQuickPopup::insetChange(), QPlatformPrintDevice::isValidPageLayout(), QCocoaPrintDevice::macPaper(), operator/(), operator<<(), QQuickPopup::paddingChange(), QPagePreview::paintEvent(), QMacPrintEngine::property(), QPdfPrintEngine::property(), QWin32PrintEngine::property(), QSGOpenVGHelpers::qDrawBorderImage(), qt_convertMargins(), QQuickPopupPositioner::reposition(), QQuickLayoutAttached::resetBottomMargin(), QQuickControlPrivate::setBottomInset(), QQuickLabelPrivate::setBottomInset(), QQuickTextAreaPrivate::setBottomInset(), QQuickTextFieldPrivate::setBottomInset(), QPageLayout::setBottomMargin(), QQuickControlPrivate::setBottomPadding(), QPageLayoutPrivate::setDefaultMargins(), QPageLayout::setMargins(), QQuickLayoutAttached::setMargins(), QPageLayout::setOrientation(), QQuickControl::setPadding(), QQuickControlPrivate::setVerticalPadding(), QQC2::QWindowsXPStyle::sizeFromContents(), and QWindowsVistaStyle::sizeFromContents().
|
inlineconstexprnoexcept |
Returns true
if all margins are very close to 0; otherwise returns false.
Definition at line 361 of file qmargins.h.
References qFuzzyIsNull().
Referenced by qt_convertMargins(), QGraphicsWidget::setContentsMargins(), QGraphicsWidget::setWindowFrameMargins(), QQC2::QWindowsXPStyle::sizeFromContents(), and QWindowsVistaStyle::sizeFromContents().
|
inlineconstexprnoexcept |
Returns the left margin.
Definition at line 364 of file qmargins.h.
Referenced by QPageLayoutPrivate::clampMargins(), QWindowsVistaStyle::drawControl(), QQuickLayout::effectiveSizeHints_helper(), QQuickPopup::insetChange(), QPlatformPrintDevice::isValidPageLayout(), QCocoaPrintDevice::macPaper(), operator/(), operator<<(), QQuickPopup::paddingChange(), QPagePreview::paintEvent(), QMacPrintEngine::property(), QPdfPrintEngine::property(), QWin32PrintEngine::property(), QSGOpenVGHelpers::qDrawBorderImage(), qt_convertMargins(), QQuickPopupPositioner::reposition(), QQuickLayoutAttached::resetLeftMargin(), QPageLayoutPrivate::setDefaultMargins(), QQuickControlPrivate::setHorizontalPadding(), QQuickControlPrivate::setLeftInset(), QQuickLabelPrivate::setLeftInset(), QQuickTextAreaPrivate::setLeftInset(), QQuickTextFieldPrivate::setLeftInset(), QPageLayout::setLeftMargin(), QQuickControlPrivate::setLeftPadding(), QPageLayout::setMargins(), QQuickLayoutAttached::setMargins(), QPageLayout::setOrientation(), QQuickControl::setPadding(), QQC2::QWindowsXPStyle::sizeFromContents(), QWindowsVistaStyle::sizeFromContents(), and QWin32PrintEnginePrivate::updateMetrics().
Multiplies each component of this object by the given finite factor and returns a reference to this object.
Definition at line 472 of file qmargins.h.
Add each component of margins to the respective component of this object and returns a reference to it.
Definition at line 444 of file qmargins.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds the given finite addend to each component of this object and returns a reference to it.
Definition at line 454 of file qmargins.h.
Subtract each component of margins from the respective component of this object and returns a reference to it.
Definition at line 449 of file qmargins.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Subtracts the given finite subtrahend from each component of this object and returns a reference to it.
Definition at line 463 of file qmargins.h.
Divides each component of this object by divisor and returns a reference to this object.
The divisor must not be either zero or NaN.
Definition at line 477 of file qmargins.h.
|
inlineconstexprnoexcept |
Returns the right margin.
Definition at line 370 of file qmargins.h.
Referenced by QPageLayoutPrivate::clampMargins(), QWindowsVistaStyle::drawControl(), QQuickLayout::effectiveSizeHints_helper(), QQuickPopup::insetChange(), QPlatformPrintDevice::isValidPageLayout(), QCocoaPrintDevice::macPaper(), operator/(), operator<<(), QQuickPopup::paddingChange(), QPagePreview::paintEvent(), QMacPrintEngine::property(), QPdfPrintEngine::property(), QWin32PrintEngine::property(), QSGOpenVGHelpers::qDrawBorderImage(), qt_convertMargins(), QQuickPopupPositioner::reposition(), QQuickLayoutAttached::resetRightMargin(), QPageLayoutPrivate::setDefaultMargins(), QQuickControlPrivate::setHorizontalPadding(), QPageLayout::setMargins(), QQuickLayoutAttached::setMargins(), QPageLayout::setOrientation(), QQuickControl::setPadding(), QQuickControlPrivate::setRightInset(), QQuickLabelPrivate::setRightInset(), QQuickTextAreaPrivate::setRightInset(), QQuickTextFieldPrivate::setRightInset(), QPageLayout::setRightMargin(), QQuickControlPrivate::setRightPadding(), QQC2::QWindowsXPStyle::sizeFromContents(), and QWindowsVistaStyle::sizeFromContents().
Sets the bottom margin to abottom (which must be finite).
Definition at line 386 of file qmargins.h.
Referenced by QPageLayout::setBottomMargin(), QQuickLayoutAttached::setBottomMargin(), and QPageLayout::setOrientation().
Sets the left margin to aleft (which must be finite).
Definition at line 377 of file qmargins.h.
Referenced by QTextDocument::print(), QPageLayout::setLeftMargin(), QQuickLayoutAttached::setLeftMargin(), and QPageLayout::setOrientation().
Sets the right margin to aright (which must be finite).
Definition at line 383 of file qmargins.h.
Referenced by QPageLayout::setOrientation(), QQuickLayoutAttached::setRightMargin(), and QPageLayout::setRightMargin().
Sets the top margin to atop (which must be finite).
Definition at line 380 of file qmargins.h.
Referenced by QPageLayout::setOrientation(), QQuickLayoutAttached::setTopMargin(), and QPageLayout::setTopMargin().
|
inlineconstexprnoexcept |
Returns an integer-based copy of this margins object.
Note that the components in the returned margins will be rounded to the nearest integer.
Definition at line 494 of file qmargins.h.
References qRound().
Referenced by QWasmWindow::frameMargins(), and QPageLayoutPrivate::marginsPoints().
|
inlineconstexprnoexcept |
Returns the top margin.
Definition at line 367 of file qmargins.h.
Referenced by QPageLayoutPrivate::clampMargins(), QWindowsVistaStyle::drawControl(), QQuickLayout::effectiveSizeHints_helper(), QQuickPopup::insetChange(), QPlatformPrintDevice::isValidPageLayout(), QCocoaPrintDevice::macPaper(), operator/(), operator<<(), QQuickPopup::paddingChange(), QPagePreview::paintEvent(), QMacPrintEngine::property(), QPdfPrintEngine::property(), QWin32PrintEngine::property(), QSGOpenVGHelpers::qDrawBorderImage(), qt_convertMargins(), QQuickPopupPositioner::reposition(), QQuickLayoutAttached::resetTopMargin(), QPageLayoutPrivate::setDefaultMargins(), QPageLayout::setMargins(), QQuickLayoutAttached::setMargins(), QPageLayout::setOrientation(), QQuickControl::setPadding(), QQuickControlPrivate::setTopInset(), QQuickLabelPrivate::setTopInset(), QQuickTextAreaPrivate::setTopInset(), QQuickTextFieldPrivate::setTopInset(), QPageLayout::setTopMargin(), QQuickControlPrivate::setTopPadding(), QQuickControlPrivate::setVerticalPadding(), QQC2::QWindowsXPStyle::sizeFromContents(), QWindowsVistaStyle::sizeFromContents(), and QWin32PrintEnginePrivate::updateMetrics().
|
friend |
Definition at line 324 of file qmargins.h.
Returns true
if lhs and rhs are sufficiently different; otherwise returns false
.
Definition at line 315 of file qmargins.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMarginsF object that is formed by multiplying each component of the given lhs margins by finite factor rhs.
Definition at line 419 of file qmargins.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMarginsF object that is formed by multiplying each component of the given lhs margins by finite factor rhs.
Definition at line 425 of file qmargins.h.
Returns a QMarginsF object that is the sum of the given margins, lhs and rhs; each component is added separately.
Definition at line 389 of file qmargins.h.
Returns a QMarginsF object that is formed by adding rhs (which must be finite) to each component of lhs.
Definition at line 401 of file qmargins.h.
Returns a QMargin object that is formed from all components of margins.
Definition at line 482 of file qmargins.h.
Returns a QMarginsF object that is formed by adding lhs (which must be finite) to each component of rhs.
Definition at line 407 of file qmargins.h.
Returns a QMarginsF object that is formed by subtracting rhs from lhs; each component is subtracted separately.
Definition at line 395 of file qmargins.h.
Returns a QMarginsF object that is formed by subtracting rhs (which must be finite) from each component of lhs.
Definition at line 413 of file qmargins.h.
Returns a QMargin object that is formed by negating all components of margins.
Definition at line 487 of file qmargins.h.
References QMargins::bottom(), QMargins::left(), QMargins::right(), and QMargins::top().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMarginsF object that is formed by dividing the components of the given lhs margins by the given rhs divisor.
The divisor must not be either zero or NaN.
Definition at line 431 of file qmargins.h.
References bottom(), left(), Q_ASSERT, right(), and top().
|
related |
Writes margin m to the given stream and returns a reference to the stream.
Definition at line 763 of file qmargins.cpp.
Returns true
if lhs and rhs are approximately equal; otherwise returns false.
Definition at line 307 of file qmargins.h.
|
related |
Reads a margin from the given stream into margin m and returns a reference to the stream.
Definition at line 779 of file qmargins.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMarginsF object that is formed from the maximum of each component of m2 and m1.
Definition at line 438 of file qmargins.h.
References qMax().