![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtCore More...
#include <qmargins.h>
Public Member Functions | |
constexpr | QMargins () noexcept |
Constructs a margins object with all margins set to 0. | |
constexpr | QMargins (int left, int top, int right, int bottom) noexcept |
Constructs margins with the given left, top, right, and bottom. | |
constexpr bool | isNull () const noexcept |
Returns true if all margins are is 0; otherwise returns false. | |
constexpr int | left () const noexcept |
Returns the left margin. | |
constexpr int | top () const noexcept |
Returns the top margin. | |
constexpr int | right () const noexcept |
Returns the right margin. | |
constexpr int | bottom () const noexcept |
Returns the bottom margin. | |
constexpr void | setLeft (int left) noexcept |
Sets the left margin to left. | |
constexpr void | setTop (int top) noexcept |
Sets the Top margin to Top. | |
constexpr void | setRight (int right) noexcept |
Sets the right margin to right. | |
constexpr void | setBottom (int bottom) noexcept |
Sets the bottom margin to bottom. | |
constexpr QMargins & | operator+= (const QMargins &margins) noexcept |
Add each component of margins to the respective component of this object and returns a reference to it. | |
constexpr QMargins & | operator-= (const QMargins &margins) noexcept |
Subtract each component of margins from the respective component of this object and returns a reference to it. | |
constexpr QMargins & | operator+= (int) 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 addend to each component of this object and returns a reference to it. | |
constexpr QMargins & | operator-= (int) 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 subtrahend from each component of this object and returns a reference to it. | |
constexpr QMargins & | operator*= (int) noexcept |
Multiplies each component of this object by factor and returns a reference to it. | |
constexpr QMargins & | operator/= (int) |
Divides each component of this object by divisor and returns a reference to it. | |
constexpr QMargins & | operator*= (qreal) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Multiplies each component of this object by factor and returns a reference to it. | |
constexpr QMargins & | operator/= (qreal) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
constexpr QMarginsF | toMarginsF () const noexcept |
Friends | |
constexpr bool | operator== (const QMargins &m1, const QMargins &m2) noexcept |
Returns true if m1 and m2 are equal; otherwise returns false . | |
constexpr bool | operator!= (const QMargins &m1, const QMargins &m2) noexcept |
Returns true if m1 and m2 are 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 >, QMargins >, bool > = true> | |
constexpr decltype(auto) | get (M &&m) noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
QMargins | operator+ (const QMargins &m1, const QMargins &m2) |
Returns a QMargins object that is the sum of the given margins, m1 and m2; each component is added separately. | |
QMargins | operator- (const QMargins &m1, const QMargins &m2) |
Returns a QMargins object that is formed by subtracting m2 from m1; each component is subtracted separately. | |
QMargins | operator+ (const QMargins &lhs, int rhs) |
Returns a QMargins object that is formed by adding rhs to lhs. | |
QMargins | operator+ (int lhs, const QMargins &rhs) |
Returns a QMargins object that is formed by adding lhs to rhs. | |
QMargins | operator- (const QMargins &lhs, int rhs) |
Returns a QMargins object that is formed by subtracting rhs from lhs. | |
QMargins | operator* (const QMargins &margins, int factor) |
Returns a QMargins object that is formed by multiplying each component of the given margins by factor. | |
QMargins | operator* (int factor, const QMargins &margins) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMargins object that is formed by multiplying each component of the given margins by factor. | |
QMargins | operator* (const QMargins &margins, qreal factor) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMargins object that is formed by multiplying each component of the given margins by factor. | |
QMargins | operator* (qreal factor, const QMargins &margins) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMargins object that is formed by multiplying each component of the given margins by factor. | |
QMargins | operator/ (const QMargins &margins, int divisor) |
Returns a QMargins object that is formed by dividing the components of the given margins by the given divisor. | |
QMargins | operator/ (const QMargins &, qreal) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QMargins object that is formed by dividing the components of the given margins by the given divisor. | |
QMargins | operator+ (const QMargins &margins) |
Returns a QMargin object that is formed from all components of margins. | |
QMargins | operator- (const QMargins &margins) |
Returns a QMargin object that is formed by negating all components of margins. | |
QMargins | operator| (const QMargins &m1, const QMargins &m2) |
Returns a QMargins object that is formed from the maximum of each component of m2 and m1. | |
QDataStream & | operator<< (QDataStream &stream, const QMargins &m) |
Writes margin m to the given stream and returns a reference to the stream. | |
QDataStream & | operator>> (QDataStream &stream, QMargins &m) |
Reads a margin from the given stream into margin m and returns a reference to the stream. | |
\inmodule QtCore
The QMargins class defines the four margins of a rectangle.
QMargin defines a set of four margins; left, top, right, and bottom, that describe the size of the borders surrounding a rectangle.
The isNull() function returns true
only if all margins are set to zero.
QMargin objects can be streamed as well as compared.
Definition at line 22 of file qmargins.h.
|
inlineconstexprnoexcept |
Constructs a margins object with all margins set to 0.
Definition at line 102 of file qmargins.h.
|
inlineconstexprnoexcept |
Constructs margins with the given left, top, right, and bottom.
Definition at line 104 of file qmargins.h.
|
inlineconstexprnoexcept |
Returns the bottom margin.
Definition at line 119 of file qmargins.h.
Referenced by QWindowCreationContext::QWindowCreationContext(), QQuickStyleMargins::bottom(), calcPosition(), QAndroidStyle::drawControl(), QLineEditPrivate::effectiveTextMargins(), QWindowsGeometryHint::frameSizeConstraints(), QWindowsGeometryHint::handleCalculateSize(), QtWaylandClient::QWaylandShmBuffer::imageInsideMargins(), QtWaylandClient::marginsRegion(), QCalendarWidget::minimumSizeHint(), QLineEdit::minimumSizeHint(), operator*(), operator*(), operator*(), operator*(), operator-(), QMarginsF::operator-(), operator/(), operator/(), QSGTextMaskMaterial::populate(), QQuickTableViewPrivate::processRebuildTable(), QQC2::qDrawBorderPixmap(), QSGSoftwareHelpers::qDrawBorderPixmap(), QtWaylandClient::QWaylandShmBackingStore::resize(), QtWaylandClient::QWaylandWindow::resizeFromApplyConfigure(), QWidgetPrivate::safeAreaMargins(), QHighDpi::scale(), QQC2::QWindowsXPStylePrivate::scrollBarGripperBounds(), QLayout::setContentsMargins(), QWidget::setContentsMargins(), QToolBarLayout::setGeometry(), QtWaylandClient::QWaylandWindow::setGeometryFromApplyConfigure(), QOffscreenWindow::setWindowState(), QComboBox::showPopup(), QAndroidStyle::AndroidControl::sizeFromContents(), QLineEdit::sizeHint(), QQC2::QCommonStyle::subElementRect(), QCommonStyle::subElementRect(), QAndroidStyle::AndroidControl::subElementRect(), QAndroidStyle::AndroidProgressBarControl::subElementRect(), QWaylandQtShellSurfacePrivate::updateFrameMargins(), QWidgetPrivate::updateFrameStrut(), QQuickStyleItem::updatePaintNode(), and QtWaylandClient::QWaylandEglWindow::updateSurface().
|
inlineconstexprnoexcept |
Returns true
if all margins are is 0; otherwise returns false.
Definition at line 107 of file qmargins.h.
Referenced by QWindowsWindowData::create(), QWindowsGeometryHint::handleCalculateSize(), QtWaylandClient::QWaylandShmBuffer::imageInsideMargins(), msgUnableToSetGeometry(), operator<<(), QSGSoftwareNinePatchNode::paint(), QWidgetPrivate::safeAreaMargins(), and QWidgetPrivate::updateFrameStrut().
|
inlineconstexprnoexcept |
Returns the left margin.
Definition at line 110 of file qmargins.h.
Referenced by QWindowCreationContext::QWindowCreationContext(), calcPosition(), QAndroidStyle::drawControl(), QLineEditPrivate::effectiveTextMargins(), QWindowsBackingStore::flush(), QtWaylandClient::QWaylandShmBackingStore::flush(), QWindowsGeometryHint::frameSizeConstraints(), QWindowsGeometryHint::handleCalculateSize(), QWindowsWindow::handleNonClientHitTest(), QWindowsWindow::handleResized(), QtWaylandClient::QWaylandShmBuffer::imageInsideMargins(), QToolBarLayout::layoutActions(), QQuickStyleMargins::left(), QtWaylandClient::QWaylandWindow::mapFromWlSurface(), QtWaylandClient::marginsRegion(), QCalendarWidget::minimumSizeHint(), QLineEdit::minimumSizeHint(), QDockWidgetPrivate::mouseMoveEvent(), operator*(), operator*(), operator*(), operator*(), operator-(), QMarginsF::operator-(), operator/(), operator/(), QSGTextMaskMaterial::populate(), QQuickTableViewPrivate::processRebuildTable(), QQC2::qDrawBorderPixmap(), QSGSoftwareHelpers::qDrawBorderPixmap(), QtWaylandClient::QWaylandWindow::repositionFromApplyConfigure(), QtWaylandClient::QWaylandShmBackingStore::resize(), QtWaylandClient::QWaylandWindow::resizeFromApplyConfigure(), QWidgetPrivate::safeAreaMargins(), QHighDpi::scale(), QQC2::QWindowsXPStylePrivate::scrollBarGripperBounds(), QLayout::setContentsMargins(), QWidget::setContentsMargins(), QToolBarLayout::setGeometry(), QCocoaWindow::setGeometry(), QWindowsWindow::setGeometry(), QtWaylandClient::QWaylandWindow::setGeometryFromApplyConfigure(), QWindowsWindow::setMask(), QOffscreenWindow::setWindowState(), QAndroidStyle::AndroidControl::sizeFromContents(), QLineEdit::sizeHint(), QQC2::QCommonStyle::subElementRect(), QCommonStyle::subElementRect(), QAndroidStyle::AndroidControl::subElementRect(), QAndroidStyle::AndroidProgressBarControl::subElementRect(), QWaylandQtShellSurfacePrivate::updateFrameMargins(), QWidgetPrivate::updateFrameStrut(), QQuickStyleItem::updatePaintNode(), QtWaylandClient::QWaylandTextInputv1::updateState(), QtWaylandClient::QWaylandTextInputv2::updateState(), QtWaylandClient::QWaylandTextInputv4::updateState(), QtWaylandClient::QWaylandEglWindow::updateSurface(), and QtWaylandClient::QWaylandWindow::windowContentGeometry().
|
inlineconstexprnoexcept |
Multiplies each component of this object by factor and returns a reference to it.
Definition at line 235 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.Multiplies each component of this object by factor and returns a reference to it.
Definition at line 245 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 207 of file qmargins.h.
|
inlineconstexprnoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds the addend to each component of this object and returns a reference to it.
Definition at line 217 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 212 of file qmargins.h.
|
inlineconstexprnoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Subtracts the subtrahend from each component of this object and returns a reference to it.
Definition at line 226 of file qmargins.h.
|
inlineconstexpr |
Divides each component of this object by divisor and returns a reference to it.
Definition at line 240 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.
Definition at line 250 of file qmargins.h.
|
inlineconstexprnoexcept |
Returns the right margin.
Definition at line 116 of file qmargins.h.
Referenced by QWindowCreationContext::QWindowCreationContext(), calcPosition(), QAndroidStyle::drawControl(), QLineEditPrivate::effectiveTextMargins(), QWindowsGeometryHint::frameSizeConstraints(), QWindowsGeometryHint::handleCalculateSize(), QtWaylandClient::QWaylandShmBuffer::imageInsideMargins(), QtWaylandClient::marginsRegion(), QCalendarWidget::minimumSizeHint(), QLineEdit::minimumSizeHint(), operator*(), operator*(), operator*(), operator*(), operator-(), QMarginsF::operator-(), operator/(), operator/(), QSGTextMaskMaterial::populate(), QQuickTableViewPrivate::processRebuildTable(), QQC2::qDrawBorderPixmap(), QSGSoftwareHelpers::qDrawBorderPixmap(), QtWaylandClient::QWaylandShmBackingStore::resize(), QtWaylandClient::QWaylandWindow::resizeFromApplyConfigure(), QQuickStyleMargins::right(), QWidgetPrivate::safeAreaMargins(), QHighDpi::scale(), QQC2::QWindowsXPStylePrivate::scrollBarGripperBounds(), QLayout::setContentsMargins(), QWidget::setContentsMargins(), QToolBarLayout::setGeometry(), QtWaylandClient::QWaylandWindow::setGeometryFromApplyConfigure(), QOffscreenWindow::setWindowState(), QAndroidStyle::AndroidControl::sizeFromContents(), QLineEdit::sizeHint(), QQC2::QCommonStyle::subElementRect(), QCommonStyle::subElementRect(), QAndroidStyle::AndroidControl::subElementRect(), QAndroidStyle::AndroidProgressBarControl::subElementRect(), QWaylandQtShellSurfacePrivate::updateFrameMargins(), QWidgetPrivate::updateFrameStrut(), QQuickStyleItem::updatePaintNode(), and QtWaylandClient::QWaylandEglWindow::updateSurface().
|
inlineconstexprnoexcept |
Sets the bottom margin to bottom.
Definition at line 132 of file qmargins.h.
Referenced by QQC2::QWindowsXPStyle::ninePatchMargins(), QSGDefaultGlyphNode::update(), and QQuickStyleItem::updatePaintNode().
|
inlineconstexprnoexcept |
Sets the left margin to left.
Definition at line 123 of file qmargins.h.
Referenced by QQC2::QWindowsXPStyle::ninePatchMargins(), and QQuickStyleItem::updatePaintNode().
|
inlineconstexprnoexcept |
Sets the right margin to right.
Definition at line 129 of file qmargins.h.
Referenced by QQC2::QWindowsXPStyle::ninePatchMargins(), and QQuickStyleItem::updatePaintNode().
|
inlineconstexprnoexcept |
Sets the Top margin to Top.
Definition at line 126 of file qmargins.h.
Referenced by QQC2::QWindowsXPStyle::ninePatchMargins(), QSGDefaultGlyphNode::update(), and QQuickStyleItem::updatePaintNode().
|
inlineconstexprnoexcept |
Returns these margins as margins with floating point accuracy.
Definition at line 492 of file qmargins.h.
|
inlineconstexprnoexcept |
Returns the top margin.
Definition at line 113 of file qmargins.h.
Referenced by QWindowCreationContext::QWindowCreationContext(), calcPosition(), QAndroidStyle::drawControl(), QLineEditPrivate::effectiveTextMargins(), QWindowsBackingStore::flush(), QtWaylandClient::QWaylandShmBackingStore::flush(), QWindowsGeometryHint::frameSizeConstraints(), QWindowsGeometryHint::handleCalculateSize(), QWindowsWindow::handleNonClientHitTest(), QtWaylandClient::QWaylandShmBuffer::imageInsideMargins(), QToolBarLayout::layoutActions(), QtWaylandClient::QWaylandWindow::mapFromWlSurface(), QtWaylandClient::marginsRegion(), QCalendarWidget::minimumSizeHint(), QLineEdit::minimumSizeHint(), QDockWidgetPrivate::mouseMoveEvent(), operator*(), operator*(), operator*(), operator*(), operator-(), QMarginsF::operator-(), operator/(), operator/(), QSGTextMaskMaterial::populate(), QQuickTableViewPrivate::processRebuildTable(), QQC2::qDrawBorderPixmap(), QSGSoftwareHelpers::qDrawBorderPixmap(), QtWaylandClient::QWaylandWindow::repositionFromApplyConfigure(), QtWaylandClient::QWaylandShmBackingStore::resize(), QtWaylandClient::QWaylandWindow::resizeFromApplyConfigure(), QWidgetPrivate::safeAreaMargins(), QHighDpi::scale(), QQC2::QWindowsXPStylePrivate::scrollBarGripperBounds(), QLayout::setContentsMargins(), QWidget::setContentsMargins(), QToolBarLayout::setGeometry(), QCocoaWindow::setGeometry(), QWindowsWindow::setGeometry(), QtWaylandClient::QWaylandWindow::setGeometryFromApplyConfigure(), QWindowsWindow::setMask(), QOffscreenWindow::setWindowState(), QComboBox::showPopup(), QAndroidStyle::AndroidControl::sizeFromContents(), QLineEdit::sizeHint(), QQC2::QCommonStyle::subElementRect(), QCommonStyle::subElementRect(), QAndroidStyle::AndroidControl::subElementRect(), QAndroidStyle::AndroidProgressBarControl::subElementRect(), QQuickStyleMargins::top(), QWaylandQtShellSurfacePrivate::updateFrameMargins(), QWidgetPrivate::updateFrameStrut(), QQuickStyleItem::updatePaintNode(), QtWaylandClient::QWaylandTextInputv1::updateState(), QtWaylandClient::QWaylandTextInputv2::updateState(), QtWaylandClient::QWaylandTextInputv4::updateState(), QtWaylandClient::QWaylandEglWindow::updateSurface(), and QtWaylandClient::QWaylandWindow::windowContentGeometry().
|
friend |
Definition at line 75 of file qmargins.h.
Returns true
if m1 and m2 are different; otherwise returns false
.
Definition at line 66 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 QMargins object that is formed by multiplying each component of the given margins by factor.
Definition at line 177 of file qmargins.h.
References bottom(), left(), qRound(), right(), and 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 QMargins object that is formed by multiplying each component of the given margins by factor.
Definition at line 171 of file qmargins.h.
References bottom(), left(), right(), and 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 QMargins object that is formed by multiplying each component of the given margins by factor.
Definition at line 183 of file qmargins.h.
References bottom(), left(), qRound(), right(), and top().
Returns a QMargins object that is formed by adding rhs to lhs.
Definition at line 147 of file qmargins.h.
Returns a QMargins object that is the sum of the given margins, m1 and m2; each component is added separately.
Definition at line 135 of file qmargins.h.
Returns a QMargin object that is formed from all components of margins.
Definition at line 255 of file qmargins.h.
Returns a QMargins object that is formed by adding lhs to rhs.
Definition at line 153 of file qmargins.h.
Returns a QMargins object that is formed by subtracting rhs from lhs.
Definition at line 159 of file qmargins.h.
Returns a QMargins object that is formed by subtracting m2 from m1; each component is subtracted separately.
Definition at line 141 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 QMargins object that is formed by dividing the components of the given margins by the given divisor.
Definition at line 195 of file qmargins.h.
References bottom(), left(), qRound(), right(), and top().
|
related |
Writes margin m to the given stream and returns a reference to the stream.
Definition at line 396 of file qmargins.cpp.
Returns true
if m1 and m2 are equal; otherwise returns false
.
Definition at line 57 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 412 of file qmargins.cpp.
Returns a QMargins object that is formed from the maximum of each component of m2 and m1.
Definition at line 201 of file qmargins.h.
References qMax().