8#include <QtCore/qcheckedint_impl.h>
9#include <QtCore/qcompare.h>
10#include <QtCore/qnamespace.h>
12#include <QtCore/q20type_traits.h>
13#include <QtCore/q23utility.h>
17QT_ENABLE_P0846_SEMANTICS_FOR(get)
23
24
30 constexpr QMargins(
int left,
int top,
int right,
int bottom)
noexcept;
32 constexpr bool isNull()
const noexcept;
34 constexpr int left()
const noexcept;
35 constexpr int top()
const noexcept;
36 constexpr int right()
const noexcept;
37 constexpr int bottom()
const noexcept;
39 constexpr void setLeft(
int left)
noexcept;
40 constexpr void setTop(
int top)
noexcept;
41 constexpr void setRight(
int right)
noexcept;
42 constexpr void setBottom(
int bottom)
noexcept;
71 constexpr QMargins(Representation left,
74 Representation bottom)
noexcept
79 Representation m_left;
81 Representation m_right;
82 Representation m_bottom;
86 return lhs.m_left == rhs.m_left
87 && lhs.m_top == rhs.m_top
88 && lhs.m_right == rhs.m_right
89 && lhs.m_bottom == rhs.m_bottom;
97 friend constexpr decltype(
auto)
get(
M &&
m)
noexcept
101 else if constexpr (
I == 1)
103 else if constexpr (
I == 2)
105 else if constexpr (
I == 3)
113
114
115#ifndef QT_NO_DATASTREAM
116Q_CORE_EXPORT
QDataStream &operator<<(QDataStream &,
const QMargins &);
121
122
130{
return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; }
133{
return m_left.value(); }
136{
return m_top.value(); }
139{
return m_right.value(); }
142{
return m_bottom.value(); }
146{ m_left.setValue(aleft); }
149{ m_top.setValue(atop); }
152{ m_right.setValue(aright); }
155{ m_bottom.setValue(abottom); }
159 return QMargins(m1.m_left + m2.m_left, m1.m_top + m2.m_top,
160 m1.m_right + m2.m_right, m1.m_bottom + m2.m_bottom);
165 return QMargins(m1.m_left - m2.m_left, m1.m_top - m2.m_top,
166 m1.m_right - m2.m_right, m1.m_bottom - m2.m_bottom);
171 return QMargins(lhs.m_left + rhs, lhs.m_top + rhs,
172 lhs.m_right + rhs, lhs.m_bottom + rhs);
177 return QMargins(rhs.m_left + lhs, rhs.m_top + lhs,
178 rhs.m_right + lhs, rhs.m_bottom + lhs);
183 return QMargins(lhs.m_left - rhs, lhs.m_top - rhs,
184 lhs.m_right - rhs, lhs.m_bottom - rhs);
189 return QMargins(margins.m_left * factor, margins.m_top * factor,
190 margins.m_right * factor, margins.m_bottom * factor);
195 return QMargins(margins.m_left * factor, margins.m_top * factor,
196 margins.m_right * factor, margins.m_bottom * factor);
202 return QMargins(QtPrivate::qSaturateRound(margins.left() * factor),
203 QtPrivate::qSaturateRound(margins.top() * factor),
204 QtPrivate::qSaturateRound(margins.right() * factor),
205 QtPrivate::qSaturateRound(margins.bottom() * factor));
210 return QMargins(QtPrivate::qSaturateRound(margins.left() * factor),
211 QtPrivate::qSaturateRound(margins.top() * factor),
212 QtPrivate::qSaturateRound(margins.right() * factor),
213 QtPrivate::qSaturateRound(margins.bottom() * factor));
218 return QMargins(margins.m_left / divisor, margins.m_top / divisor,
219 margins.m_right / divisor, margins.m_bottom / divisor);
224 Q_ASSERT(!qFuzzyIsNull(divisor));
225 return QMargins(QtPrivate::qSaturateRound(margins.left() / divisor),
226 QtPrivate::qSaturateRound(margins.top() / divisor),
227 QtPrivate::qSaturateRound(margins.right() / divisor),
228 QtPrivate::qSaturateRound(margins.bottom() / divisor));
233 return QMargins(qMax(m1.m_left, m2.m_left), qMax(m1.m_top, m2.m_top),
234 qMax(m1.m_right, m2.m_right), qMax(m1.m_bottom, m2.m_bottom));
239 return *
this = *
this + margins;
244 return *
this = *
this - margins;
267 return *
this = *
this * factor;
272 return *
this = *
this / divisor;
277 return *
this = *
this * factor;
282 return *
this = *
this / divisor;
292 return QMargins(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
295#ifndef QT_NO_DEBUG_STREAM
296Q_CORE_EXPORT
QDebug operator<<(QDebug,
const QMargins &);
300
301
307 constexpr QMarginsF(qreal left, qreal top, qreal right, qreal bottom)
noexcept;
310 constexpr bool isNull()
const noexcept;
313 constexpr qreal top()
const noexcept;
317 constexpr void setLeft(qreal aleft)
noexcept;
318 constexpr void setTop(qreal atop)
noexcept;
319 constexpr void setRight(qreal aright)
noexcept;
320 constexpr void setBottom(qreal abottom)
noexcept;
339 return QtPrivate::fuzzyCompare(lhs.m_left, rhs.m_left)
340 && QtPrivate::fuzzyCompare(lhs.m_top, rhs.m_top)
341 && QtPrivate::fuzzyCompare(lhs.m_right, rhs.m_right)
342 && QtPrivate::fuzzyCompare(lhs.m_bottom, rhs.m_bottom);
346 return qFuzzyIsNull(m.m_left) && qFuzzyIsNull(m.m_top)
347 && qFuzzyIsNull(m.m_right) && qFuzzyIsNull(m.m_bottom);
364 friend constexpr decltype(
auto)
get(
M &&
m)
noexcept
366 if constexpr (
I == 0)
368 else if constexpr (
I == 1)
370 else if constexpr (
I == 2)
372 else if constexpr (
I == 3)
380
381
383#ifndef QT_NO_DATASTREAM
384Q_CORE_EXPORT
QDataStream &operator<<(QDataStream &,
const QMarginsF &);
389
390
402{
return qFuzzyIsNull(m_left) && qFuzzyIsNull(m_top) && qFuzzyIsNull(m_right) && qFuzzyIsNull(m_bottom); }
427{ m_bottom = abottom; }
431 return QMarginsF(lhs.left() + rhs.left(), lhs.top() + rhs.top(),
432 lhs.right() + rhs.right(), lhs.bottom() + rhs.bottom());
437 return QMarginsF(lhs.left() - rhs.left(), lhs.top() - rhs.top(),
438 lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom());
443 return QMarginsF(lhs.left() + rhs, lhs.top() + rhs,
444 lhs.right() + rhs, lhs.bottom() + rhs);
449 return QMarginsF(rhs.left() + lhs, rhs.top() + lhs,
450 rhs.right() + lhs, rhs.bottom() + lhs);
455 return QMarginsF(lhs.left() - rhs, lhs.top() - rhs,
456 lhs.right() - rhs, lhs.bottom() - rhs);
461 return QMarginsF(lhs.left() * rhs, lhs.top() * rhs,
462 lhs.right() * rhs, lhs.bottom() * rhs);
467 return QMarginsF(rhs.left() * lhs, rhs.top() * lhs,
468 rhs.right() * lhs, rhs.bottom() * lhs);
473 Q_ASSERT(divisor < 0 || divisor > 0);
474 return QMarginsF(lhs.left() / divisor, lhs.top() / divisor,
475 lhs.right() / divisor, lhs.bottom() / divisor);
480 return QMarginsF(qMax(m1.left(), m2.left()), qMax(m1.top(), m2.top()),
481 qMax(m1.right(), m2.right()), qMax(m1.bottom(), m2.bottom()));
486 return *
this = *
this + margins;
491 return *
this = *
this - margins;
505 m_left -= subtrahend;
507 m_right -= subtrahend;
508 m_bottom -= subtrahend;
514 return *
this = *
this * factor;
519 return *
this = *
this / divisor;
529 return QMarginsF(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
536 return QMargins(QtPrivate::qSaturateRound(m_left),
537 QtPrivate::qSaturateRound(m_top),
538 QtPrivate::qSaturateRound(m_right),
539 QtPrivate::qSaturateRound(m_bottom));
542#ifndef QT_NO_DEBUG_STREAM
543Q_CORE_EXPORT
QDebug operator<<(QDebug,
const QMarginsF &);
549
550
\inmodule QtCore\reentrant
friend constexpr bool qFuzzyIsNull(const QMarginsF &m) noexcept
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).
friend constexpr bool qFuzzyCompare(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
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.
friend constexpr bool comparesEqual(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
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.
friend constexpr QMargins operator+(const QMargins &lhs, int rhs) noexcept
Returns a QMargins object that is formed by adding rhs to lhs.
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr QMarginsF toMarginsF() const noexcept
friend constexpr QMargins operator-(const QMargins &lhs, int rhs) noexcept
Returns a QMargins object that is formed by subtracting rhs from lhs.
friend constexpr QMargins operator+(const QMargins &m1, const QMargins &m2) noexcept
Returns a QMargins object that is the sum of the given margins, m1 and m2; each component is added se...
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.
friend constexpr QMargins operator*(int factor, const QMargins &margins) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
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.
friend constexpr 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...
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...
friend constexpr QMargins operator-(const QMargins &m1, const QMargins &m2) noexcept
Returns a QMargins object that is formed by subtracting m2 from m1; each component is subtracted sepa...
friend constexpr QMargins operator|(const QMargins &m1, const QMargins &m2) noexcept
Returns a QMargins object that is formed from the maximum of each component of m2 and m1.
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 QMargins operator+(int lhs, const QMargins &rhs) noexcept
Returns a QMargins object that is formed by adding lhs to rhs.
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.
friend constexpr QMargins operator*(const QMargins &margins, int factor) noexcept
Returns a QMargins object that is formed by multiplying each component of the given margins by factor...
constexpr void setRight(int right) noexcept
Sets the right margin to right.
Combined button and popup list for selecting options.
QT_FOR_EACH_CORE_FOUNDATION_TYPE(QT_DECLARE_WEAK_QDEBUG_OPERATOR_FOR_CF_TYPE)
int csr_get_active_config(csr_config_t *) __attribute__((weak_import))
void objc_autoreleasePoolPop(void *pool)
QT_END_NAMESPACE QT_USE_NAMESPACE void * objc_autoreleasePoolPush(void)
QDebug operator<<(QDebug dbg, const NSObject *nsObject)
AppleApplication * qt_apple_sharedApplication()
Q_CONSTRUCTOR_FUNCTION(qt_apple_check_os_version)
Q_CORE_EXPORT bool qt_apple_isApplicationExtension()
Q_CORE_EXPORT bool qt_apple_isSandboxed()
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
QDebug operator<<(QDebug debug, QIODevice::OpenMode modes)
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 QMarginsF operator/(const QMarginsF &lhs, qreal divisor)
constexpr QMargins operator+(const QMargins &margins) noexcept
constexpr QMarginsF operator*(const QMarginsF &lhs, qreal rhs) noexcept
Q_DECLARE_TYPEINFO(QMarginsF, Q_RELOCATABLE_TYPE)
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