7#include <QtCore/qcompare.h>
8#include <QtCore/qnamespace.h>
10#include <QtCore/q20type_traits.h>
11#include <QtCore/q23utility.h>
15QT_ENABLE_P0846_SEMANTICS_FOR(get)
20
21
27 constexpr QMargins(
int left,
int top,
int right,
int bottom)
noexcept;
29 constexpr bool isNull()
const noexcept;
31 constexpr int left()
const noexcept;
32 constexpr int top()
const noexcept;
33 constexpr int right()
const noexcept;
34 constexpr int bottom()
const noexcept;
36 constexpr void setLeft(
int left)
noexcept;
37 constexpr void setTop(
int top)
noexcept;
38 constexpr void setRight(
int right)
noexcept;
39 constexpr void setBottom(
int bottom)
noexcept;
60 return lhs.m_left == rhs.m_left
61 && lhs.m_top == rhs.m_top
62 && lhs.m_right == rhs.m_right
63 && lhs.m_bottom == rhs.m_bottom;
71 friend constexpr decltype(
auto)
get(
M &&
m)
noexcept
75 else if constexpr (
I == 1)
77 else if constexpr (
I == 2)
79 else if constexpr (
I == 3)
87
88
89#ifndef QT_NO_DATASTREAM
95
96
98constexpr inline QMargins::
QMargins()
noexcept : m_left(0), m_top(0), m_right(0), m_bottom(0) {}
101 : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {}
104{
return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; }
129{ m_bottom = abottom; }
205 return *
this = *
this + margins;
210 return *
this = *
this - margins;
233 return *
this = *
this * factor;
238 return *
this = *
this / divisor;
243 return *
this = *
this * factor;
248 return *
this = *
this / divisor;
261#ifndef QT_NO_DEBUG_STREAM
266
267
273 constexpr QMarginsF(qreal left, qreal top, qreal right, qreal bottom)
noexcept;
276 constexpr bool isNull()
const noexcept;
279 constexpr qreal top()
const noexcept;
283 constexpr void setLeft(qreal aleft)
noexcept;
284 constexpr void setTop(qreal atop)
noexcept;
285 constexpr void setRight(qreal aright)
noexcept;
286 constexpr void setBottom(qreal abottom)
noexcept;
304 QT_WARNING_DISABLE_FLOAT_COMPARE
337 friend constexpr decltype(
auto)
get(
M &&
m)
noexcept
339 if constexpr (
I == 0)
341 else if constexpr (
I == 1)
343 else if constexpr (
I == 2)
345 else if constexpr (
I == 3)
353
354
356#ifndef QT_NO_DATASTREAM
362
363
375{
return qFuzzyIsNull(m_left) && qFuzzyIsNull(m_top) && qFuzzyIsNull(m_right) && qFuzzyIsNull(m_bottom); }
400{ m_bottom = abottom; }
404 return QMarginsF(lhs.left() + rhs.left(), lhs.top() + rhs.top(),
405 lhs.right() + rhs.right(), lhs.bottom() + rhs.bottom());
410 return QMarginsF(lhs.left() - rhs.left(), lhs.top() - rhs.top(),
411 lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom());
416 return QMarginsF(lhs.left() + rhs, lhs.top() + rhs,
417 lhs.right() + rhs, lhs.bottom() + rhs);
422 return QMarginsF(rhs.left() + lhs, rhs.top() + lhs,
423 rhs.right() + lhs, rhs.bottom() + lhs);
428 return QMarginsF(lhs.left() - rhs, lhs.top() - rhs,
429 lhs.right() - rhs, lhs.bottom() - rhs);
434 return QMarginsF(lhs.left() * rhs, lhs.top() * rhs,
435 lhs.right() * rhs, lhs.bottom() * rhs);
440 return QMarginsF(rhs.left() * lhs, rhs.top() * lhs,
441 rhs.right() * lhs, rhs.bottom() * lhs);
446 Q_ASSERT(divisor < 0 || divisor > 0);
447 return QMarginsF(lhs.left() / divisor, lhs.top() / divisor,
448 lhs.right() / divisor, lhs.bottom() / divisor);
453 return QMarginsF(qMax(m1.left(), m2.left()), qMax(m1.top(), m2.top()),
454 qMax(m1.right(), m2.right()), qMax(m1.bottom(), m2.bottom()));
459 return *
this = *
this + margins;
464 return *
this = *
this - margins;
478 m_left -= subtrahend;
480 m_right -= subtrahend;
481 m_bottom -= subtrahend;
487 return *
this = *
this * factor;
492 return *
this = *
this / divisor;
502 return QMarginsF(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
509 return QMargins(qRound(m_left), qRound(m_top), qRound(m_right), qRound(m_bottom));
512#ifndef QT_NO_DEBUG_STREAM
519
520
524 class tuple_size<QT_PREPEND_NAMESPACE(QMargins)> :
public integral_constant<size_t, 4> {};
526 class tuple_element<0, QT_PREPEND_NAMESPACE(QMargins)> {
public:
using type =
int; };
\inmodule QtCore\reentrant
constexpr QMarginsF & operator-=(const QMarginsF &margins) noexcept
Subtract each component of margins from the respective component of this object and returns a referen...
constexpr qreal right() const noexcept
Returns the right margin.
constexpr qreal left() const noexcept
Returns the left margin.
constexpr QMarginsF() noexcept
Constructs a margins object with all margins set to 0.
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 QMarginsF & operator+=(const QMarginsF &margins) noexcept
Add each component of margins to the respective component of this object and returns a reference to i...
constexpr QMarginsF & operator-=(qreal subtrahend) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr QMarginsF & operator/=(qreal divisor)
Divides each component of this object by divisor and returns a reference to this object.
constexpr bool isNull() const noexcept
Returns true if all margins are very close to 0; otherwise returns false.
constexpr QMarginsF(const QMargins &margins) noexcept
Constructs margins copied from the given margins.
constexpr QMargins toMargins() const noexcept
Returns an integer-based copy of this margins object.
constexpr QMarginsF & operator*=(qreal factor) noexcept
Multiplies each component of this object by the given finite factor and returns a reference to this o...
constexpr void setRight(qreal aright) noexcept
Sets the right margin to aright (which must be finite).
constexpr QMarginsF(qreal left, qreal top, qreal right, qreal bottom) noexcept
Constructs margins with the given left, top, right, and bottom.
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 QMarginsF & operator+=(qreal addend) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr qreal bottom() const noexcept
Returns the bottom margin.
constexpr void setTop(int top) noexcept
Sets the Top margin to Top.
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr QMarginsF toMarginsF() const noexcept
constexpr QMargins & operator-=(int) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr bool isNull() const noexcept
Returns true if all margins are is 0; otherwise returns false.
constexpr void setBottom(int bottom) noexcept
Sets the bottom margin to bottom.
constexpr void setLeft(int left) noexcept
Sets the left margin to left.
constexpr QMargins & operator-=(const QMargins &margins) noexcept
Subtract each component of margins from the respective component of this object and returns a referen...
constexpr int left() const noexcept
Returns the left margin.
constexpr QMargins & operator*=(int) noexcept
Multiplies each component of this object by factor and returns a reference to it.
friend constexpr bool comparesEqual(const QMargins &lhs, const QMargins &rhs) noexcept
constexpr QMargins & operator+=(int) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr QMargins & operator/=(int)
Divides each component of this object by divisor and returns a reference to it.
constexpr QMargins & operator+=(const QMargins &margins) noexcept
Add each component of margins to the respective component of this object and returns a reference to i...
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 int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
constexpr void setRight(int right) noexcept
Sets the right margin to right.
Combined button and popup list for selecting options.
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
QDebug operator<<(QDebug dbg, const QMargins &m)
QDebug operator<<(QDebug dbg, const QMarginsF &m)
QDataStream & operator>>(QDataStream &s, QMargins &m)
QDataStream & operator>>(QDataStream &s, QMarginsF &m)
constexpr QMarginsF operator*(qreal lhs, const QMarginsF &rhs) noexcept
constexpr QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
constexpr QMarginsF operator|(const QMarginsF &m1, const QMarginsF &m2) noexcept
constexpr QMargins operator+(int lhs, const QMargins &rhs) noexcept
constexpr QMargins operator|(const QMargins &m1, const QMargins &m2) noexcept
constexpr QMarginsF operator/(const QMarginsF &lhs, qreal divisor)
constexpr QMargins operator+(const QMargins &lhs, int rhs) noexcept
constexpr QMargins operator-(const QMargins &lhs, int rhs) noexcept
constexpr QMargins operator+(const QMargins &margins) noexcept
constexpr QMargins operator/(const QMargins &margins, int divisor)
constexpr QMargins operator*(const QMargins &margins, int factor) noexcept
constexpr QMarginsF operator*(const QMarginsF &lhs, qreal rhs) noexcept
Q_DECLARE_TYPEINFO(QMarginsF, Q_RELOCATABLE_TYPE)
constexpr QMargins operator-(const QMargins &m1, const QMargins &m2) noexcept
constexpr QMargins operator*(int factor, const QMargins &margins) noexcept
constexpr QMargins operator+(const QMargins &m1, const QMargins &m2) noexcept
constexpr QMarginsF operator+(qreal lhs, const QMarginsF &rhs) noexcept
constexpr QMarginsF operator+(const QMarginsF &margins) noexcept
Q_DECLARE_TYPEINFO(QMargins, Q_RELOCATABLE_TYPE)
constexpr QMarginsF operator+(const QMarginsF &lhs, qreal rhs) noexcept
constexpr QMarginsF operator-(const QMarginsF &lhs, qreal rhs) noexcept
constexpr QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
constexpr QMargins operator-(const QMargins &margins) noexcept
constexpr QMarginsF operator-(const QMarginsF &margins) noexcept