7#include <QtCore/qnamespace.h>
9#include <QtCore/q20type_traits.h>
10#include <QtCore/q23utility.h>
14QT_ENABLE_P0846_SEMANTICS_FOR(
get)
28 constexpr bool isNull()
const noexcept;
30 constexpr int left()
const noexcept;
31 constexpr int top()
const noexcept;
32 constexpr int right()
const noexcept;
33 constexpr int bottom()
const noexcept;
60 m1.m_left == m2.m_left &&
61 m1.m_top == m2.m_top &&
62 m1.m_right == m2.m_right &&
63 m1.m_bottom == m2.m_bottom;
71 template <std::size_t I,
73 std::enable_if_t<(I < 4), bool> =
true,
74 std::enable_if_t<std::is_same_v<q20::remove_cvref_t<M>,
QMargins>,
bool> =
true>
75 friend constexpr decltype(
auto)
get(
M &&
m)
noexcept
78 return q23::forward_like<M>(
m.m_left);
79 else if constexpr (I == 1)
80 return q23::forward_like<M>(
m.m_top);
81 else if constexpr (I == 2)
82 return q23::forward_like<M>(
m.m_right);
83 else if constexpr (I == 3)
84 return q23::forward_like<M>(
m.m_bottom);
93#ifndef QT_NO_DATASTREAM
105 : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {}
108{
return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; }
133{ m_bottom = abottom; }
137 return QMargins(m1.left() + m2.left(), m1.top() + m2.top(),
138 m1.right() + m2.right(), m1.bottom() + m2.bottom());
143 return QMargins(m1.left() - m2.left(), m1.top() - m2.top(),
144 m1.right() - m2.right(), m1.bottom() - m2.bottom());
149 return QMargins(lhs.left() + rhs, lhs.top() + rhs,
150 lhs.right() + rhs, lhs.bottom() + rhs);
155 return QMargins(rhs.left() + lhs, rhs.top() + lhs,
156 rhs.right() + lhs, rhs.bottom() + lhs);
161 return QMargins(lhs.left() - rhs, lhs.top() - rhs,
162 lhs.right() - rhs, lhs.bottom() - rhs);
168 margins.
right() * factor, margins.
bottom() * factor);
174 margins.
right() * factor, margins.
bottom() * factor);
204 qMax(m1.right(), m2.right()),
qMax(m1.bottom(), m2.bottom()));
209 return *
this = *
this + margins;
214 return *
this = *
this - margins;
237 return *
this = *
this * factor;
242 return *
this = *
this /
divisor;
247 return *
this = *
this * factor;
252 return *
this = *
this /
divisor;
265#ifndef QT_NO_DEBUG_STREAM
280 constexpr bool isNull()
const noexcept;
283 constexpr qreal top()
const noexcept;
317 return !(lhs == rhs);
320 template <std::size_t I,
322 std::enable_if_t<(I < 4), bool> =
true,
323 std::enable_if_t<std::is_same_v<q20::remove_cvref_t<M>,
QMarginsF>,
bool> =
true>
324 friend constexpr decltype(
auto)
get(
M &&
m)
noexcept
326 if constexpr (I == 0)
327 return q23::forward_like<M>(
m.m_left);
328 else if constexpr (I == 1)
329 return q23::forward_like<M>(
m.m_top);
330 else if constexpr (I == 2)
331 return q23::forward_like<M>(
m.m_right);
332 else if constexpr (I == 3)
333 return q23::forward_like<M>(
m.m_bottom);
343#ifndef QT_NO_DATASTREAM
353 : m_left(0), m_top(0), m_right(0), m_bottom(0) {}
356 : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {}
359 : m_left(margins.
left()), m_top(margins.
top()), m_right(margins.
right()), m_bottom(margins.
bottom()) {}
387{ m_bottom = abottom; }
391 return QMarginsF(lhs.left() + rhs.left(), lhs.top() + rhs.top(),
392 lhs.right() + rhs.right(), lhs.bottom() + rhs.bottom());
397 return QMarginsF(lhs.left() - rhs.left(), lhs.top() - rhs.top(),
398 lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom());
403 return QMarginsF(lhs.left() + rhs, lhs.top() + rhs,
404 lhs.right() + rhs, lhs.bottom() + rhs);
409 return QMarginsF(rhs.left() + lhs, rhs.top() + lhs,
410 rhs.right() + lhs, rhs.bottom() + lhs);
415 return QMarginsF(lhs.left() - rhs, lhs.top() - rhs,
416 lhs.right() - rhs, lhs.bottom() - rhs);
421 return QMarginsF(lhs.left() * rhs, lhs.top() * rhs,
422 lhs.right() * rhs, lhs.bottom() * rhs);
427 return QMarginsF(rhs.left() * lhs, rhs.top() * lhs,
428 rhs.right() * lhs, rhs.bottom() * lhs);
433 Q_ASSERT(divisor < 0 || divisor > 0);
441 qMax(m1.right(), m2.right()),
qMax(m1.bottom(), m2.bottom()));
446 return *
this = *
this + margins;
451 return *
this = *
this - margins;
465 m_left -= subtrahend;
467 m_right -= subtrahend;
468 m_bottom -= subtrahend;
474 return *
this = *
this * factor;
479 return *
this = *
this /
divisor;
499#ifndef QT_NO_DEBUG_STREAM
\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 divisor)
Divides each component of this object by divisor and returns a reference to this object.
friend constexpr bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
Returns true if lhs and rhs are sufficiently different; otherwise returns false.
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.
friend constexpr decltype(auto) get(M &&m) noexcept
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 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.
friend constexpr bool operator==(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
Returns true if lhs and rhs are approximately equal; otherwise returns false.
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 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.
friend constexpr bool operator==(const QMargins &m1, const QMargins &m2) noexcept
Returns true if m1 and m2 are equal; otherwise returns false.
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.
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.
friend constexpr decltype(auto) get(M &&m) noexcept
friend constexpr bool operator!=(const QMargins &m1, const QMargins &m2) noexcept
Returns true if m1 and m2 are different; otherwise returns false.
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.
QT_PREPEND_NAMESPACE(qreal) type
QT_PREPEND_NAMESPACE(qreal) type
QT_PREPEND_NAMESPACE(qreal) type
QT_PREPEND_NAMESPACE(qreal) type
Combined button and popup list for selecting options.
static QDBusError::ErrorType get(const char *name)
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
constexpr QMargins operator|(const QMargins &m1, const QMargins &m2) noexcept
constexpr QMargins operator/(const QMargins &margins, int divisor)
constexpr QMargins operator*(const QMargins &margins, int factor) noexcept
constexpr QMargins operator-(const QMargins &m1, const QMargins &m2) noexcept
constexpr QMargins operator+(const QMargins &m1, const QMargins &m2) noexcept
Q_CORE_EXPORT QDataStream & operator<<(QDataStream &, const QMargins &)
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QMargins &)
constexpr const T & qMax(const T &a, const T &b)
GLdouble GLdouble GLdouble GLdouble top
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId