Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qmargins.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QMARGINS_H
5#define QMARGINS_H
6
7#include <QtCore/qcheckedint_impl.h>
8#include <QtCore/qcompare.h>
9#include <QtCore/qnamespace.h>
10
11#include <QtCore/q20type_traits.h>
12#include <QtCore/q23utility.h>
13
14QT_BEGIN_NAMESPACE
15
16QT_ENABLE_P0846_SEMANTICS_FOR(get)
17
18class QDataStream;
19class QMarginsF;
20
21/*****************************************************************************
22 QMargins class
23 *****************************************************************************/
24
26{
27public:
28 constexpr QMargins() noexcept;
29 constexpr QMargins(int left, int top, int right, int bottom) noexcept;
30
31 constexpr bool isNull() const noexcept;
32
33 constexpr int left() const noexcept;
34 constexpr int top() const noexcept;
35 constexpr int right() const noexcept;
36 constexpr int bottom() const noexcept;
37
38 constexpr void setLeft(int left) noexcept;
39 constexpr void setTop(int top) noexcept;
40 constexpr void setRight(int right) noexcept;
41 constexpr void setBottom(int bottom) noexcept;
42
43 constexpr QMargins &operator+=(const QMargins &margins) noexcept;
44 constexpr QMargins &operator-=(const QMargins &margins) noexcept;
45 constexpr QMargins &operator+=(int) noexcept;
46 constexpr QMargins &operator-=(int) noexcept;
47 constexpr QMargins &operator*=(int) noexcept;
48 constexpr QMargins &operator/=(int);
49 constexpr QMargins &operator*=(qreal) noexcept;
50 constexpr QMargins &operator/=(qreal);
51
52 [[nodiscard]] constexpr inline QMarginsF toMarginsF() const noexcept;
53
54 friend constexpr inline QMargins operator+(const QMargins &m1, const QMargins &m2) noexcept;
55 friend constexpr inline QMargins operator-(const QMargins &m1, const QMargins &m2) noexcept;
56 friend constexpr inline QMargins operator+(const QMargins &lhs, int rhs) noexcept;
57 friend constexpr inline QMargins operator+(int lhs, const QMargins &rhs) noexcept;
58 friend constexpr inline QMargins operator-(const QMargins &lhs, int rhs) noexcept;
59 friend constexpr inline QMargins operator*(const QMargins &margins, int factor) noexcept;
60 friend constexpr inline QMargins operator*(int factor, const QMargins &margins) noexcept;
61 friend constexpr inline QMargins operator*(const QMargins &margins, qreal factor) noexcept;
62 friend constexpr inline QMargins operator*(qreal factor, const QMargins &margins) noexcept;
63 friend constexpr inline QMargins operator/(const QMargins &margins, int divisor);
64 friend constexpr inline QMargins operator/(const QMargins &margins, qreal divisor);
65 friend constexpr inline QMargins operator|(const QMargins &m1, const QMargins &m2) noexcept;
66
67private:
69
70 constexpr QMargins(Representation left,
71 Representation top,
72 Representation right,
73 Representation bottom) noexcept
75 {
76 }
77
78 Representation m_left;
79 Representation m_top;
80 Representation m_right;
81 Representation m_bottom;
82
83 friend constexpr bool comparesEqual(const QMargins &lhs, const QMargins &rhs) noexcept
84 {
85 return lhs.m_left == rhs.m_left
86 && lhs.m_top == rhs.m_top
87 && lhs.m_right == rhs.m_right
88 && lhs.m_bottom == rhs.m_bottom;
89 }
91
92 template <std::size_t I,
93 typename M,
94 std::enable_if_t<(I < 4), bool> = true,
96 friend constexpr decltype(auto) get(M &&m) noexcept
97 {
98 if constexpr (I == 0)
100 else if constexpr (I == 1)
102 else if constexpr (I == 2)
104 else if constexpr (I == 3)
106 }
107};
108
110
111/*****************************************************************************
112 QMargins stream functions
113 *****************************************************************************/
114#ifndef QT_NO_DATASTREAM
115Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QMargins &);
116Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMargins &);
117#endif
118
119/*****************************************************************************
120 QMargins inline functions
121 *****************************************************************************/
122
123constexpr inline QMargins::QMargins() noexcept : m_left(0), m_top(0), m_right(0), m_bottom(0) {}
124
125constexpr inline QMargins::QMargins(int aleft, int atop, int aright, int abottom) noexcept
127
128constexpr inline bool QMargins::isNull() const noexcept
129{ return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; }
130
131constexpr inline int QMargins::left() const noexcept
132{ return m_left.value(); }
133
134constexpr inline int QMargins::top() const noexcept
135{ return m_top.value(); }
136
137constexpr inline int QMargins::right() const noexcept
138{ return m_right.value(); }
139
140constexpr inline int QMargins::bottom() const noexcept
141{ return m_bottom.value(); }
142
143
144constexpr inline void QMargins::setLeft(int aleft) noexcept
145{ m_left.setValue(aleft); }
146
147constexpr inline void QMargins::setTop(int atop) noexcept
148{ m_top.setValue(atop); }
149
150constexpr inline void QMargins::setRight(int aright) noexcept
151{ m_right.setValue(aright); }
152
153constexpr inline void QMargins::setBottom(int abottom) noexcept
154{ m_bottom.setValue(abottom); }
155
156constexpr inline QMargins operator+(const QMargins &m1, const QMargins &m2) noexcept
157{
158 return QMargins(m1.m_left + m2.m_left, m1.m_top + m2.m_top,
159 m1.m_right + m2.m_right, m1.m_bottom + m2.m_bottom);
160}
161
162constexpr inline QMargins operator-(const QMargins &m1, const QMargins &m2) noexcept
163{
164 return QMargins(m1.m_left - m2.m_left, m1.m_top - m2.m_top,
165 m1.m_right - m2.m_right, m1.m_bottom - m2.m_bottom);
166}
167
168constexpr inline QMargins operator+(const QMargins &lhs, int rhs) noexcept
169{
170 return QMargins(lhs.m_left + rhs, lhs.m_top + rhs,
171 lhs.m_right + rhs, lhs.m_bottom + rhs);
172}
173
174constexpr inline QMargins operator+(int lhs, const QMargins &rhs) noexcept
175{
176 return QMargins(rhs.m_left + lhs, rhs.m_top + lhs,
177 rhs.m_right + lhs, rhs.m_bottom + lhs);
178}
179
180constexpr inline QMargins operator-(const QMargins &lhs, int rhs) noexcept
181{
182 return QMargins(lhs.m_left - rhs, lhs.m_top - rhs,
183 lhs.m_right - rhs, lhs.m_bottom - rhs);
184}
185
186constexpr inline QMargins operator*(const QMargins &margins, int factor) noexcept
187{
188 return QMargins(margins.m_left * factor, margins.m_top * factor,
189 margins.m_right * factor, margins.m_bottom * factor);
190}
191
192constexpr inline QMargins operator*(int factor, const QMargins &margins) noexcept
193{
194 return QMargins(margins.m_left * factor, margins.m_top * factor,
195 margins.m_right * factor, margins.m_bottom * factor);
196}
197
198constexpr inline QMargins operator*(const QMargins &margins, qreal factor) noexcept
199{
200 // Deliberately using left(), top() etc. (checked ints don't have FP arithmetic)
201 return QMargins(QtPrivate::qSaturateRound(margins.left() * factor),
202 QtPrivate::qSaturateRound(margins.top() * factor),
203 QtPrivate::qSaturateRound(margins.right() * factor),
204 QtPrivate::qSaturateRound(margins.bottom() * factor));
205}
206
207constexpr inline QMargins operator*(qreal factor, const QMargins &margins) noexcept
208{
209 return QMargins(QtPrivate::qSaturateRound(margins.left() * factor),
210 QtPrivate::qSaturateRound(margins.top() * factor),
211 QtPrivate::qSaturateRound(margins.right() * factor),
212 QtPrivate::qSaturateRound(margins.bottom() * factor));
213}
214
215constexpr inline QMargins operator/(const QMargins &margins, int divisor)
216{
217 return QMargins(margins.m_left / divisor, margins.m_top / divisor,
218 margins.m_right / divisor, margins.m_bottom / divisor);
219}
220
221constexpr inline QMargins operator/(const QMargins &margins, qreal divisor)
222{
223 Q_ASSERT(!qFuzzyIsNull(divisor));
224 return QMargins(QtPrivate::qSaturateRound(margins.left() / divisor),
225 QtPrivate::qSaturateRound(margins.top() / divisor),
226 QtPrivate::qSaturateRound(margins.right() / divisor),
227 QtPrivate::qSaturateRound(margins.bottom() / divisor));
228}
229
230constexpr inline QMargins operator|(const QMargins &m1, const QMargins &m2) noexcept
231{
232 return QMargins(qMax(m1.m_left, m2.m_left), qMax(m1.m_top, m2.m_top),
233 qMax(m1.m_right, m2.m_right), qMax(m1.m_bottom, m2.m_bottom));
234}
235
236constexpr inline QMargins &QMargins::operator+=(const QMargins &margins) noexcept
237{
238 return *this = *this + margins;
239}
240
241constexpr inline QMargins &QMargins::operator-=(const QMargins &margins) noexcept
242{
243 return *this = *this - margins;
244}
245
246constexpr inline QMargins &QMargins::operator+=(int margin) noexcept
247{
248 m_left += margin;
249 m_top += margin;
250 m_right += margin;
251 m_bottom += margin;
252 return *this;
253}
254
255constexpr inline QMargins &QMargins::operator-=(int margin) noexcept
256{
257 m_left -= margin;
258 m_top -= margin;
259 m_right -= margin;
260 m_bottom -= margin;
261 return *this;
262}
263
264constexpr inline QMargins &QMargins::operator*=(int factor) noexcept
265{
266 return *this = *this * factor;
267}
268
269constexpr inline QMargins &QMargins::operator/=(int divisor)
270{
271 return *this = *this / divisor;
272}
273
274constexpr inline QMargins &QMargins::operator*=(qreal factor) noexcept
275{
276 return *this = *this * factor;
277}
278
279constexpr inline QMargins &QMargins::operator/=(qreal divisor)
280{
281 return *this = *this / divisor;
282}
283
284constexpr inline QMargins operator+(const QMargins &margins) noexcept
285{
286 return margins;
287}
288
289constexpr inline QMargins operator-(const QMargins &margins) noexcept
290{
291 return QMargins(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
292}
293
294#ifndef QT_NO_DEBUG_STREAM
295Q_CORE_EXPORT QDebug operator<<(QDebug, const QMargins &);
296#endif
297
298/*****************************************************************************
299 QMarginsF class
300 *****************************************************************************/
301
303{
304public:
305 constexpr QMarginsF() noexcept;
306 constexpr QMarginsF(qreal left, qreal top, qreal right, qreal bottom) noexcept;
307 constexpr QMarginsF(const QMargins &margins) noexcept;
308
309 constexpr bool isNull() const noexcept;
310
311 constexpr qreal left() const noexcept;
312 constexpr qreal top() const noexcept;
313 constexpr qreal right() const noexcept;
314 constexpr qreal bottom() const noexcept;
315
316 constexpr void setLeft(qreal aleft) noexcept;
317 constexpr void setTop(qreal atop) noexcept;
318 constexpr void setRight(qreal aright) noexcept;
319 constexpr void setBottom(qreal abottom) noexcept;
320
321 constexpr QMarginsF &operator+=(const QMarginsF &margins) noexcept;
322 constexpr QMarginsF &operator-=(const QMarginsF &margins) noexcept;
323 constexpr QMarginsF &operator+=(qreal addend) noexcept;
324 constexpr QMarginsF &operator-=(qreal subtrahend) noexcept;
325 constexpr QMarginsF &operator*=(qreal factor) noexcept;
326 constexpr QMarginsF &operator/=(qreal divisor);
327
328 constexpr inline QMargins toMargins() const noexcept;
329
330private:
331 qreal m_left;
332 qreal m_top;
333 qreal m_right;
334 qreal m_bottom;
335
336 QT_WARNING_PUSH
337 QT_WARNING_DISABLE_FLOAT_COMPARE
350 friend constexpr bool qFuzzyIsNull(const QMarginsF &m) noexcept
351 {
354 }
355
356 friend constexpr bool comparesEqual(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
357 {
358 return qFuzzyCompare(lhs, rhs);
359 }
361
362 friend constexpr bool comparesEqual(const QMarginsF &lhs, const QMargins &rhs) noexcept
363 { return comparesEqual(lhs, rhs.toMarginsF()); }
365
366 template <std::size_t I,
367 typename M,
368 std::enable_if_t<(I < 4), bool> = true,
370 friend constexpr decltype(auto) get(M &&m) noexcept
371 {
372 if constexpr (I == 0)
373 return q23::forward_like<M>(m.m_left);
374 else if constexpr (I == 1)
375 return q23::forward_like<M>(m.m_top);
376 else if constexpr (I == 2)
377 return q23::forward_like<M>(m.m_right);
378 else if constexpr (I == 3)
379 return q23::forward_like<M>(m.m_bottom);
380 }
381};
382
384
385/*****************************************************************************
386 QMarginsF stream functions
387 *****************************************************************************/
388
389#ifndef QT_NO_DATASTREAM
390Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QMarginsF &);
391Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMarginsF &);
392#endif
393
394/*****************************************************************************
395 QMarginsF inline functions
396 *****************************************************************************/
397
398constexpr inline QMarginsF::QMarginsF() noexcept
399 : m_left(0), m_top(0), m_right(0), m_bottom(0) {}
400
401constexpr inline QMarginsF::QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom) noexcept
403
404constexpr inline QMarginsF::QMarginsF(const QMargins &margins) noexcept
406
407constexpr inline bool QMarginsF::isNull() const noexcept
408{ return qFuzzyIsNull(m_left) && qFuzzyIsNull(m_top) && qFuzzyIsNull(m_right) && qFuzzyIsNull(m_bottom); }
409
410constexpr inline qreal QMarginsF::left() const noexcept
411{ return m_left; }
412
413constexpr inline qreal QMarginsF::top() const noexcept
414{ return m_top; }
415
416constexpr inline qreal QMarginsF::right() const noexcept
417{ return m_right; }
418
419constexpr inline qreal QMarginsF::bottom() const noexcept
420{ return m_bottom; }
421
422
423constexpr inline void QMarginsF::setLeft(qreal aleft) noexcept
424{ m_left = aleft; }
425
426constexpr inline void QMarginsF::setTop(qreal atop) noexcept
427{ m_top = atop; }
428
429constexpr inline void QMarginsF::setRight(qreal aright) noexcept
430{ m_right = aright; }
431
432constexpr inline void QMarginsF::setBottom(qreal abottom) noexcept
433{ m_bottom = abottom; }
434
435constexpr inline QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
436{
437 return QMarginsF(lhs.left() + rhs.left(), lhs.top() + rhs.top(),
438 lhs.right() + rhs.right(), lhs.bottom() + rhs.bottom());
439}
440
441constexpr inline QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
442{
443 return QMarginsF(lhs.left() - rhs.left(), lhs.top() - rhs.top(),
444 lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom());
445}
446
447constexpr inline QMarginsF operator+(const QMarginsF &lhs, qreal rhs) noexcept
448{
449 return QMarginsF(lhs.left() + rhs, lhs.top() + rhs,
450 lhs.right() + rhs, lhs.bottom() + rhs);
451}
452
453constexpr inline QMarginsF operator+(qreal lhs, const QMarginsF &rhs) noexcept
454{
455 return QMarginsF(rhs.left() + lhs, rhs.top() + lhs,
456 rhs.right() + lhs, rhs.bottom() + lhs);
457}
458
459constexpr inline QMarginsF operator-(const QMarginsF &lhs, qreal rhs) noexcept
460{
461 return QMarginsF(lhs.left() - rhs, lhs.top() - rhs,
462 lhs.right() - rhs, lhs.bottom() - rhs);
463}
464
465constexpr inline QMarginsF operator*(const QMarginsF &lhs, qreal rhs) noexcept
466{
467 return QMarginsF(lhs.left() * rhs, lhs.top() * rhs,
468 lhs.right() * rhs, lhs.bottom() * rhs);
469}
470
471constexpr inline QMarginsF operator*(qreal lhs, const QMarginsF &rhs) noexcept
472{
473 return QMarginsF(rhs.left() * lhs, rhs.top() * lhs,
474 rhs.right() * lhs, rhs.bottom() * lhs);
475}
476
477constexpr inline QMarginsF operator/(const QMarginsF &lhs, qreal divisor)
478{
479 Q_ASSERT(divisor < 0 || divisor > 0);
480 return QMarginsF(lhs.left() / divisor, lhs.top() / divisor,
481 lhs.right() / divisor, lhs.bottom() / divisor);
482}
483
484constexpr inline QMarginsF operator|(const QMarginsF &m1, const QMarginsF &m2) noexcept
485{
486 return QMarginsF(qMax(m1.left(), m2.left()), qMax(m1.top(), m2.top()),
487 qMax(m1.right(), m2.right()), qMax(m1.bottom(), m2.bottom()));
488}
489
490constexpr inline QMarginsF &QMarginsF::operator+=(const QMarginsF &margins) noexcept
491{
492 return *this = *this + margins;
493}
494
495constexpr inline QMarginsF &QMarginsF::operator-=(const QMarginsF &margins) noexcept
496{
497 return *this = *this - margins;
498}
499
500constexpr inline QMarginsF &QMarginsF::operator+=(qreal addend) noexcept
501{
502 m_left += addend;
503 m_top += addend;
504 m_right += addend;
505 m_bottom += addend;
506 return *this;
507}
508
509constexpr inline QMarginsF &QMarginsF::operator-=(qreal subtrahend) noexcept
510{
511 m_left -= subtrahend;
512 m_top -= subtrahend;
513 m_right -= subtrahend;
514 m_bottom -= subtrahend;
515 return *this;
516}
517
518constexpr inline QMarginsF &QMarginsF::operator*=(qreal factor) noexcept
519{
520 return *this = *this * factor;
521}
522
523constexpr inline QMarginsF &QMarginsF::operator/=(qreal divisor)
524{
525 return *this = *this / divisor;
526}
527
528constexpr inline QMarginsF operator+(const QMarginsF &margins) noexcept
529{
530 return margins;
531}
532
533constexpr inline QMarginsF operator-(const QMarginsF &margins) noexcept
534{
535 return QMarginsF(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
536}
537
538constexpr QMarginsF QMargins::toMarginsF() const noexcept { return *this; }
539
540constexpr inline QMargins QMarginsF::toMargins() const noexcept
541{
542 return QMargins(QtPrivate::qSaturateRound(m_left),
543 QtPrivate::qSaturateRound(m_top),
544 QtPrivate::qSaturateRound(m_right),
545 QtPrivate::qSaturateRound(m_bottom));
546}
547
548#ifndef QT_NO_DEBUG_STREAM
549Q_CORE_EXPORT QDebug operator<<(QDebug, const QMarginsF &);
550#endif
551
552QT_END_NAMESPACE
553
554/*****************************************************************************
555 QMargins/QMarginsF tuple protocol
556 *****************************************************************************/
557
558namespace std {
559 template <>
560 class tuple_size<QT_PREPEND_NAMESPACE(QMargins)> : public integral_constant<size_t, 4> {};
561 template <>
562 class tuple_element<0, QT_PREPEND_NAMESPACE(QMargins)> { public: using type = int; };
563 template <>
564 class tuple_element<1, QT_PREPEND_NAMESPACE(QMargins)> { public: using type = int; };
565 template <>
566 class tuple_element<2, QT_PREPEND_NAMESPACE(QMargins)> { public: using type = int; };
567 template <>
568 class tuple_element<3, QT_PREPEND_NAMESPACE(QMargins)> { public: using type = int; };
569
570 template <>
571 class tuple_size<QT_PREPEND_NAMESPACE(QMarginsF)> : public integral_constant<size_t, 4> {};
572 template <>
573 class tuple_element<0, QT_PREPEND_NAMESPACE(QMarginsF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); };
574 template <>
575 class tuple_element<1, QT_PREPEND_NAMESPACE(QMarginsF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); };
576 template <>
577 class tuple_element<2, QT_PREPEND_NAMESPACE(QMarginsF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); };
578 template <>
579 class tuple_element<3, QT_PREPEND_NAMESPACE(QMarginsF)> { public: using type = QT_PREPEND_NAMESPACE(qreal); };
580}
581
582#endif // QMARGINS_H
\inmodule QtCore\reentrant
Definition qdatastream.h:49
\inmodule QtCore
Definition qmargins.h:303
constexpr QMarginsF & operator-=(const QMarginsF &margins) noexcept
Subtract each component of margins from the respective component of this object and returns a referen...
Definition qmargins.h:495
constexpr qreal right() const noexcept
Returns the right margin.
Definition qmargins.h:416
constexpr qreal left() const noexcept
Returns the left margin.
Definition qmargins.h:410
constexpr QMarginsF() noexcept
Constructs a margins object with all margins set to 0.
Definition qmargins.h:398
constexpr qreal top() const noexcept
Returns the top margin.
Definition qmargins.h:413
constexpr void setLeft(qreal aleft) noexcept
Sets the left margin to aleft (which must be finite).
Definition qmargins.h:423
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...
Definition qmargins.h:490
constexpr QMarginsF & operator-=(qreal subtrahend) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qmargins.h:509
constexpr QMarginsF & operator/=(qreal divisor)
Divides each component of this object by divisor and returns a reference to this object.
Definition qmargins.h:523
constexpr bool isNull() const noexcept
Returns true if all margins are very close to 0; otherwise returns false.
Definition qmargins.h:407
constexpr QMarginsF(const QMargins &margins) noexcept
Constructs margins copied from the given margins.
Definition qmargins.h:404
constexpr QMargins toMargins() const noexcept
Returns an integer-based copy of this margins object.
Definition qmargins.h:540
constexpr QMarginsF & operator*=(qreal factor) noexcept
Multiplies each component of this object by the given finite factor and returns a reference to this o...
Definition qmargins.h:518
constexpr void setRight(qreal aright) noexcept
Sets the right margin to aright (which must be finite).
Definition qmargins.h:429
constexpr QMarginsF(qreal left, qreal top, qreal right, qreal bottom) noexcept
Constructs margins with the given left, top, right, and bottom.
Definition qmargins.h:401
constexpr void setBottom(qreal abottom) noexcept
Sets the bottom margin to abottom (which must be finite).
Definition qmargins.h:432
constexpr void setTop(qreal atop) noexcept
Sets the top margin to atop (which must be finite).
Definition qmargins.h:426
constexpr QMarginsF & operator+=(qreal addend) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qmargins.h:500
constexpr qreal bottom() const noexcept
Returns the bottom margin.
Definition qmargins.h:419
\inmodule QtCore
Definition qmargins.h:26
constexpr void setTop(int top) noexcept
Sets the Top margin to Top.
Definition qmargins.h:147
friend constexpr QMargins operator+(const QMargins &lhs, int rhs) noexcept
Returns a QMargins object that is formed by adding rhs to lhs.
Definition qmargins.h:168
constexpr int bottom() const noexcept
Returns the bottom margin.
Definition qmargins.h:140
constexpr QMarginsF toMarginsF() const noexcept
Definition qmargins.h:538
friend constexpr QMargins operator-(const QMargins &lhs, int rhs) noexcept
Returns a QMargins object that is formed by subtracting rhs from lhs.
Definition qmargins.h:180
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...
Definition qmargins.h:156
constexpr QMargins & operator-=(int) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qmargins.h:255
constexpr bool isNull() const noexcept
Returns true if all margins are is 0; otherwise returns false.
Definition qmargins.h:128
constexpr void setBottom(int bottom) noexcept
Sets the bottom margin to bottom.
Definition qmargins.h:153
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...
Definition qmargins.h:192
constexpr void setLeft(int left) noexcept
Sets the left margin to left.
Definition qmargins.h:144
constexpr QMargins & operator-=(const QMargins &margins) noexcept
Subtract each component of margins from the respective component of this object and returns a referen...
Definition qmargins.h:241
constexpr int left() const noexcept
Returns the left margin.
Definition qmargins.h:131
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...
Definition qmargins.h:215
constexpr QMargins & operator*=(int) noexcept
Multiplies each component of this object by factor and returns a reference to it.
Definition qmargins.h:264
friend constexpr bool comparesEqual(const QMargins &lhs, const QMargins &rhs) noexcept
Definition qmargins.h:83
constexpr QMargins & operator+=(int) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qmargins.h:246
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...
Definition qmargins.h:162
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.
Definition qmargins.h:230
constexpr QMargins & operator/=(int)
Divides each component of this object by divisor and returns a reference to it.
Definition qmargins.h:269
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...
Definition qmargins.h:236
constexpr QMargins() noexcept
Constructs a margins object with all margins set to 0.
Definition qmargins.h:123
friend constexpr QMargins operator+(int lhs, const QMargins &rhs) noexcept
Returns a QMargins object that is formed by adding lhs to rhs.
Definition qmargins.h:174
constexpr QMargins(int left, int top, int right, int bottom) noexcept
Constructs margins with the given left, top, right, and bottom.
Definition qmargins.h:125
constexpr int right() const noexcept
Returns the right margin.
Definition qmargins.h:137
constexpr int top() const noexcept
Returns the top margin.
Definition qmargins.h:134
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...
Definition qmargins.h:186
constexpr void setRight(int right) noexcept
Sets the right margin to right.
Definition qmargins.h:150
Combined button and popup list for selecting options.
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2462
QDebug operator<<(QDebug dbg, const QMargins &m)
Definition qmargins.cpp:428
QDebug operator<<(QDebug dbg, const QMarginsF &m)
Definition qmargins.cpp:816
QDataStream & operator>>(QDataStream &s, QMargins &m)
Definition qmargins.cpp:416
QDataStream & operator>>(QDataStream &s, QMarginsF &m)
Definition qmargins.cpp:803
constexpr QMarginsF operator*(qreal lhs, const QMarginsF &rhs) noexcept
Definition qmargins.h:471
constexpr QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
Definition qmargins.h:435
constexpr QMarginsF operator|(const QMarginsF &m1, const QMarginsF &m2) noexcept
Definition qmargins.h:484
constexpr QMarginsF operator/(const QMarginsF &lhs, qreal divisor)
Definition qmargins.h:477
constexpr QMargins operator+(const QMargins &margins) noexcept
Definition qmargins.h:284
constexpr QMarginsF operator*(const QMarginsF &lhs, qreal rhs) noexcept
Definition qmargins.h:465
Q_DECLARE_TYPEINFO(QMarginsF, Q_RELOCATABLE_TYPE)
constexpr QMarginsF operator+(qreal lhs, const QMarginsF &rhs) noexcept
Definition qmargins.h:453
constexpr QMarginsF operator+(const QMarginsF &margins) noexcept
Definition qmargins.h:528
Q_DECLARE_TYPEINFO(QMargins, Q_RELOCATABLE_TYPE)
constexpr QMarginsF operator+(const QMarginsF &lhs, qreal rhs) noexcept
Definition qmargins.h:447
constexpr QMarginsF operator-(const QMarginsF &lhs, qreal rhs) noexcept
Definition qmargins.h:459
constexpr QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) noexcept
Definition qmargins.h:441
constexpr QMargins operator-(const QMargins &margins) noexcept
Definition qmargins.h:289
constexpr QMarginsF operator-(const QMarginsF &margins) noexcept
Definition qmargins.h:533