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)
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;
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;
67 template <std::size_t I,
69 std::enable_if_t<(I < 4), bool> =
true,
70 std::enable_if_t<std::is_same_v<q20::remove_cvref_t<M>,
QMargins>,
bool> =
true>
71 friend constexpr decltype(
auto)
get(
M &&
m)
noexcept
74 return q23::forward_like<M>(
m.m_left);
75 else if constexpr (I == 1)
76 return q23::forward_like<M>(
m.m_top);
77 else if constexpr (I == 2)
78 return q23::forward_like<M>(
m.m_right);
79 else if constexpr (I == 3)
80 return q23::forward_like<M>(
m.m_bottom);
89#ifndef QT_NO_DATASTREAM
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; }
133 return QMargins(m1.left() + m2.left(), m1.top() + m2.top(),
134 m1.right() + m2.right(), m1.bottom() + m2.bottom());
139 return QMargins(m1.left() - m2.left(), m1.top() - m2.top(),
140 m1.right() - m2.right(), m1.bottom() - m2.bottom());
145 return QMargins(lhs.left() + rhs, lhs.top() + rhs,
146 lhs.right() + rhs, lhs.bottom() + rhs);
151 return QMargins(rhs.left() + lhs, rhs.top() + lhs,
152 rhs.right() + lhs, rhs.bottom() + lhs);
157 return QMargins(lhs.left() - rhs, lhs.top() - rhs,
158 lhs.right() - rhs, lhs.bottom() - rhs);
164 margins.
right() * factor, margins.
bottom() * factor);
170 margins.
right() * factor, margins.
bottom() * factor);
200 qMax(m1.right(), m2.right()),
qMax(m1.bottom(), m2.bottom()));
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
276 constexpr bool isNull()
const noexcept;
279 constexpr qreal top()
const noexcept;
307 return ((!lhs.m_left || !rhs.m_left) ?
qFuzzyIsNull(lhs.m_left - rhs.m_left)
309 && ((!lhs.m_top || !rhs.m_top) ?
qFuzzyIsNull(lhs.m_top - rhs.m_top)
311 && ((!lhs.m_right || !rhs.m_right) ?
qFuzzyIsNull(lhs.m_right - rhs.m_right)
313 && ((!lhs.m_bottom || !rhs.m_bottom) ?
qFuzzyIsNull(lhs.m_bottom - rhs.m_bottom)
333 template <std::size_t I,
335 std::enable_if_t<(I < 4), bool> =
true,
336 std::enable_if_t<std::is_same_v<q20::remove_cvref_t<M>,
QMarginsF>,
bool> =
true>
337 friend constexpr decltype(
auto)
get(
M &&
m)
noexcept
339 if constexpr (I == 0)
340 return q23::forward_like<M>(
m.m_left);
341 else if constexpr (I == 1)
342 return q23::forward_like<M>(
m.m_top);
343 else if constexpr (I == 2)
344 return q23::forward_like<M>(
m.m_right);
345 else if constexpr (I == 3)
346 return q23::forward_like<M>(
m.m_bottom);
356#ifndef QT_NO_DATASTREAM
366 : m_left(0), m_top(0), m_right(0), m_bottom(0) {}
369 : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {}
372 : m_left(margins.
left()), m_top(margins.
top()), m_right(margins.
right()), m_bottom(margins.
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);
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;
512#ifndef QT_NO_DEBUG_STREAM
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; };
528 class tuple_element<1, QT_PREPEND_NAMESPACE(
QMargins)> {
public:
using type = int; };
530 class tuple_element<2, QT_PREPEND_NAMESPACE(
QMargins)> {
public:
using type = int; };
532 class tuple_element<3, QT_PREPEND_NAMESPACE(
QMargins)> {
public:
using type = int; };
535 class tuple_size<QT_PREPEND_NAMESPACE(
QMarginsF)> :
public integral_constant<size_t, 4> {};
537 class tuple_element<0, QT_PREPEND_NAMESPACE(
QMarginsF)> {
public:
using type = QT_PREPEND_NAMESPACE(
qreal); };
539 class tuple_element<1, QT_PREPEND_NAMESPACE(
QMarginsF)> {
public:
using type = QT_PREPEND_NAMESPACE(
qreal); };
541 class tuple_element<2, QT_PREPEND_NAMESPACE(
QMarginsF)> {
public:
using type = QT_PREPEND_NAMESPACE(
qreal); };
543 class tuple_element<3, QT_PREPEND_NAMESPACE(
QMarginsF)> {
public:
using type = QT_PREPEND_NAMESPACE(
qreal); };
\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 comparesEqual(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE friend constexpr bool qFuzzyCompare(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
QT_WARNING_POP friend constexpr bool qFuzzyIsNull(const QMarginsF &m) noexcept
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.
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.
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)
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
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.
#define Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(...)
#define QT_WARNING_DISABLE_FLOAT_COMPARE
static QDBusError::ErrorType get(const char *name)
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)