Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qmargins.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - |
4 | ** Contact: http://www.qt.io/licensing/ | - |
5 | ** | - |
6 | ** This file is part of the QtCore module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - |
15 | ** information use the contact form at http://www.qt.io/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 or version 3 as published by the Free | - |
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - |
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - |
22 | ** following information to ensure the GNU Lesser General Public License | - |
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - |
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
25 | ** | - |
26 | ** As a special exception, The Qt Company gives you certain additional | - |
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - |
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
29 | ** | - |
30 | ** $QT_END_LICENSE$ | - |
31 | ** | - |
32 | ****************************************************************************/ | - |
33 | - | |
34 | #include "qmargins.h" | - |
35 | #include "qdatastream.h" | - |
36 | - | |
37 | #include <private/qdebug_p.h> | - |
38 | - | |
39 | QT_BEGIN_NAMESPACE | - |
40 | - | |
41 | /*! | - |
42 | \class QMargins | - |
43 | \inmodule QtCore | - |
44 | \ingroup painting | - |
45 | \since 4.6 | - |
46 | - | |
47 | \brief The QMargins class defines the four margins of a rectangle. | - |
48 | - | |
49 | QMargin defines a set of four margins; left, top, right and bottom, | - |
50 | that describe the size of the borders surrounding a rectangle. | - |
51 | - | |
52 | The isNull() function returns \c true only if all margins are set to zero. | - |
53 | - | |
54 | QMargin objects can be streamed as well as compared. | - |
55 | */ | - |
56 | - | |
57 | - | |
58 | /***************************************************************************** | - |
59 | QMargins member functions | - |
60 | *****************************************************************************/ | - |
61 | - | |
62 | /*! | - |
63 | \fn QMargins::QMargins() | - |
64 | - | |
65 | Constructs a margins object with all margins set to 0. | - |
66 | - | |
67 | \sa isNull() | - |
68 | */ | - |
69 | - | |
70 | /*! | - |
71 | \fn QMargins::QMargins(int left, int top, int right, int bottom) | - |
72 | - | |
73 | Constructs margins with the given \a left, \a top, \a right, \a bottom | - |
74 | - | |
75 | \sa setLeft(), setRight(), setTop(), setBottom() | - |
76 | */ | - |
77 | - | |
78 | /*! | - |
79 | \fn bool QMargins::isNull() const | - |
80 | - | |
81 | Returns \c true if all margins are is 0; otherwise returns | - |
82 | false. | - |
83 | */ | - |
84 | - | |
85 | - | |
86 | /*! | - |
87 | \fn int QMargins::left() const | - |
88 | - | |
89 | Returns the left margin. | - |
90 | - | |
91 | \sa setLeft() | - |
92 | */ | - |
93 | - | |
94 | /*! | - |
95 | \fn int QMargins::top() const | - |
96 | - | |
97 | Returns the top margin. | - |
98 | - | |
99 | \sa setTop() | - |
100 | */ | - |
101 | - | |
102 | /*! | - |
103 | \fn int QMargins::right() const | - |
104 | - | |
105 | Returns the right margin. | - |
106 | */ | - |
107 | - | |
108 | /*! | - |
109 | \fn int QMargins::bottom() const | - |
110 | - | |
111 | Returns the bottom margin. | - |
112 | */ | - |
113 | - | |
114 | - | |
115 | /*! | - |
116 | \fn void QMargins::setLeft(int left) | - |
117 | - | |
118 | Sets the left margin to \a left. | - |
119 | */ | - |
120 | - | |
121 | /*! | - |
122 | \fn void QMargins::setTop(int Top) | - |
123 | - | |
124 | Sets the Top margin to \a Top. | - |
125 | */ | - |
126 | - | |
127 | /*! | - |
128 | \fn void QMargins::setRight(int right) | - |
129 | - | |
130 | Sets the right margin to \a right. | - |
131 | */ | - |
132 | - | |
133 | /*! | - |
134 | \fn void QMargins::setBottom(int bottom) | - |
135 | - | |
136 | Sets the bottom margin to \a bottom. | - |
137 | */ | - |
138 | - | |
139 | /*! | - |
140 | \fn bool operator==(const QMargins &m1, const QMargins &m2) | - |
141 | \relates QMargins | - |
142 | - | |
143 | Returns \c true if \a m1 and \a m2 are equal; otherwise returns \c false. | - |
144 | */ | - |
145 | - | |
146 | /*! | - |
147 | \fn bool operator!=(const QMargins &m1, const QMargins &m2) | - |
148 | \relates QMargins | - |
149 | - | |
150 | Returns \c true if \a m1 and \a m2 are different; otherwise returns \c false. | - |
151 | */ | - |
152 | - | |
153 | /*! | - |
154 | \fn const QMargins operator+(const QMargins &m1, const QMargins &m2) | - |
155 | \relates QMargins | - |
156 | - | |
157 | Returns a QMargins object that is the sum of the given margins, \a m1 | - |
158 | and \a m2; each component is added separately. | - |
159 | - | |
160 | \sa QMargins::operator+=(), QMargins::operator-=() | - |
161 | - | |
162 | \since 5.1 | - |
163 | */ | - |
164 | - | |
165 | /*! | - |
166 | \fn const QMargins operator-(const QMargins &m1, const QMargins &m2) | - |
167 | \relates QMargins | - |
168 | - | |
169 | Returns a QMargins object that is formed by subtracting \a m2 from | - |
170 | \a m1; each component is subtracted separately. | - |
171 | - | |
172 | \sa QMargins::operator+=(), QMargins::operator-=() | - |
173 | - | |
174 | \since 5.1 | - |
175 | */ | - |
176 | - | |
177 | /*! | - |
178 | \fn const QMargins operator+(const QMargins &lhs, int rhs) | - |
179 | \relates QMargins | - |
180 | - | |
181 | Returns a QMargins object that is formed by adding \a rhs to | - |
182 | \a lhs. | - |
183 | - | |
184 | \sa QMargins::operator+=(), QMargins::operator-=() | - |
185 | - | |
186 | \since 5.3 | - |
187 | */ | - |
188 | - | |
189 | /*! | - |
190 | \fn const QMargins operator+(int lhs, const QMargins &rhs) | - |
191 | \relates QMargins | - |
192 | - | |
193 | Returns a QMargins object that is formed by adding \a lhs to | - |
194 | \a rhs. | - |
195 | - | |
196 | \sa QMargins::operator+=(), QMargins::operator-=() | - |
197 | - | |
198 | \since 5.3 | - |
199 | */ | - |
200 | - | |
201 | /*! | - |
202 | \fn const QMargins operator-(const QMargins &lhs, int rhs) | - |
203 | \relates QMargins | - |
204 | - | |
205 | Returns a QMargins object that is formed by subtracting \a rhs from | - |
206 | \a lhs. | - |
207 | - | |
208 | \sa QMargins::operator+=(), QMargins::operator-=() | - |
209 | - | |
210 | \since 5.3 | - |
211 | */ | - |
212 | - | |
213 | /*! | - |
214 | \fn const QMargins operator*(const QMargins &margins, int factor) | - |
215 | \relates QMargins | - |
216 | - | |
217 | Returns a QMargins object that is formed by multiplying each component | - |
218 | of the given \a margins by \a factor. | - |
219 | - | |
220 | \sa QMargins::operator*=(), QMargins::operator/=() | - |
221 | - | |
222 | \since 5.1 | - |
223 | */ | - |
224 | - | |
225 | /*! | - |
226 | \fn const QMargins operator*(int factor, const QMargins &margins) | - |
227 | \relates QMargins | - |
228 | \overload | - |
229 | - | |
230 | Returns a QMargins object that is formed by multiplying each component | - |
231 | of the given \a margins by \a factor. | - |
232 | - | |
233 | \sa QMargins::operator*=(), QMargins::operator/=() | - |
234 | - | |
235 | \since 5.1 | - |
236 | */ | - |
237 | - | |
238 | /*! | - |
239 | \fn const QMargins operator*(const QMargins &margins, qreal factor) | - |
240 | \relates QMargins | - |
241 | \overload | - |
242 | - | |
243 | Returns a QMargins object that is formed by multiplying each component | - |
244 | of the given \a margins by \a factor. | - |
245 | - | |
246 | \sa QMargins::operator*=(), QMargins::operator/=() | - |
247 | - | |
248 | \since 5.1 | - |
249 | */ | - |
250 | - | |
251 | /*! | - |
252 | \fn const QMargins operator*(qreal factor, const QMargins &margins) | - |
253 | \relates QMargins | - |
254 | \overload | - |
255 | - | |
256 | Returns a QMargins object that is formed by multiplying each component | - |
257 | of the given \a margins by \a factor. | - |
258 | - | |
259 | \sa QMargins::operator*=(), QMargins::operator/=() | - |
260 | - | |
261 | \since 5.1 | - |
262 | */ | - |
263 | - | |
264 | /*! | - |
265 | \fn const QMargins operator/(const QMargins &margins, int divisor) | - |
266 | \relates QMargins | - |
267 | - | |
268 | Returns a QMargins object that is formed by dividing the components of | - |
269 | the given \a margins by the given \a divisor. | - |
270 | - | |
271 | \sa QMargins::operator*=(), QMargins::operator/=() | - |
272 | - | |
273 | \since 5.1 | - |
274 | */ | - |
275 | - | |
276 | /*! | - |
277 | \fn const QMargins operator/(const QMargins &, qreal) | - |
278 | \relates QMargins | - |
279 | \overload | - |
280 | - | |
281 | Returns a QMargins object that is formed by dividing the components of | - |
282 | the given \a margins by the given \a divisor. | - |
283 | - | |
284 | \sa QMargins::operator*=(), QMargins::operator/=() | - |
285 | - | |
286 | \since 5.1 | - |
287 | */ | - |
288 | - | |
289 | /*! | - |
290 | \fn QMargins operator+(const QMargins &margins) | - |
291 | \relates QMargins | - |
292 | - | |
293 | Returns a QMargin object that is formed from all components of \a margins. | - |
294 | - | |
295 | \since 5.3 | - |
296 | */ | - |
297 | - | |
298 | /*! | - |
299 | \fn QMargins operator-(const QMargins &margins) | - |
300 | \relates QMargins | - |
301 | - | |
302 | Returns a QMargin object that is formed by negating all components of \a margins. | - |
303 | - | |
304 | \since 5.1 | - |
305 | */ | - |
306 | - | |
307 | /*! | - |
308 | \fn QMargins &QMargins::operator+=(const QMargins &margins) | - |
309 | - | |
310 | Add each component of \a margins to the respective component of this object | - |
311 | and returns a reference to it. | - |
312 | - | |
313 | \sa operator-=() | - |
314 | - | |
315 | \since 5.1 | - |
316 | */ | - |
317 | - | |
318 | /*! | - |
319 | \fn QMargins &QMargins::operator-=(const QMargins &margins) | - |
320 | - | |
321 | Subtract each component of \a margins from the respective component of this object | - |
322 | and returns a reference to it. | - |
323 | - | |
324 | \sa operator+=() | - |
325 | - | |
326 | \since 5.1 | - |
327 | */ | - |
328 | - | |
329 | /*! | - |
330 | \fn QMargins &QMargins::operator+=(int addend) | - |
331 | \overload | - |
332 | - | |
333 | Adds the \a addend to each component of this object | - |
334 | and returns a reference to it. | - |
335 | - | |
336 | \sa operator-=() | - |
337 | */ | - |
338 | - | |
339 | /*! | - |
340 | \fn QMargins &QMargins::operator-=(int subtrahend) | - |
341 | \overload | - |
342 | - | |
343 | Subtracts the \a subtrahend from each component of this object | - |
344 | and returns a reference to it. | - |
345 | - | |
346 | \sa operator+=() | - |
347 | */ | - |
348 | - | |
349 | /*! | - |
350 | \fn QMargins &QMargins::operator*=(int factor) | - |
351 | - | |
352 | Multiplies each component of this object by \a factor | - |
353 | and returns a reference to it. | - |
354 | - | |
355 | \sa operator/=() | - |
356 | - | |
357 | \since 5.1 | - |
358 | */ | - |
359 | - | |
360 | /*! | - |
361 | \fn QMargins &QMargins::operator*=(qreal factor) | - |
362 | \overload | - |
363 | - | |
364 | Multiplies each component of this object by \a factor | - |
365 | and returns a reference to it. | - |
366 | - | |
367 | \sa operator/=() | - |
368 | - | |
369 | \since 5.1 | - |
370 | */ | - |
371 | - | |
372 | /*! | - |
373 | \fn QMargins &QMargins::operator/=(int divisor) | - |
374 | - | |
375 | Divides each component of this object by \a divisor | - |
376 | and returns a reference to it. | - |
377 | - | |
378 | \sa operator*=() | - |
379 | - | |
380 | \since 5.1 | - |
381 | */ | - |
382 | - | |
383 | /*! | - |
384 | \fn QMargins &QMargins::operator/=(qreal divisor) | - |
385 | - | |
386 | \overload | - |
387 | - | |
388 | \sa operator*=() | - |
389 | - | |
390 | \since 5.1 | - |
391 | */ | - |
392 | - | |
393 | /***************************************************************************** | - |
394 | QMargins stream functions | - |
395 | *****************************************************************************/ | - |
396 | #ifndef QT_NO_DATASTREAM | - |
397 | /*! | - |
398 | \fn QDataStream &operator<<(QDataStream &stream, const QMargins &m) | - |
399 | \relates QMargins | - |
400 | - | |
401 | Writes margin \a m to the given \a stream and returns a | - |
402 | reference to the stream. | - |
403 | - | |
404 | \sa {Serializing Qt Data Types} | - |
405 | */ | - |
406 | - | |
407 | QDataStream &operator<<(QDataStream &s, const QMargins &m) | - |
408 | { | - |
409 | s << m.left() << m.top() << m.right() << m.bottom(); | - |
410 | return s; executed 1 time by 1 test: return s; Executed by:
| 1 |
411 | } | - |
412 | - | |
413 | /*! | - |
414 | \fn QDataStream &operator>>(QDataStream &stream, QMargins &m) | - |
415 | \relates QMargins | - |
416 | - | |
417 | Reads a margin from the given \a stream into margin \a m | - |
418 | and returns a reference to the stream. | - |
419 | - | |
420 | \sa {Serializing Qt Data Types} | - |
421 | */ | - |
422 | - | |
423 | QDataStream &operator>>(QDataStream &s, QMargins &m) | - |
424 | { | - |
425 | int left, top, right, bottom; | - |
426 | s >> left; m.setLeft(left); | - |
427 | s >> top; m.setTop(top); | - |
428 | s >> right; m.setRight(right); | - |
429 | s >> bottom; m.setBottom(bottom); | - |
430 | return s; executed 1 time by 1 test: return s; Executed by:
| 1 |
431 | } | - |
432 | #endif // QT_NO_DATASTREAM | - |
433 | - | |
434 | #ifndef QT_NO_DEBUG_STREAM | - |
435 | QDebug operator<<(QDebug dbg, const QMargins &m) | - |
436 | { | - |
437 | QDebugStateSaver saver(dbg); | - |
438 | dbg.nospace(); | - |
439 | dbg << "QMargins" << '('; | - |
440 | QtDebugUtils::formatQMargins(dbg, m); | - |
441 | dbg << ')'; | - |
442 | return dbg; never executed: return dbg; | 0 |
443 | } | - |
444 | #endif | - |
445 | - | |
446 | /*! | - |
447 | \class QMarginsF | - |
448 | \inmodule QtCore | - |
449 | \ingroup painting | - |
450 | \since 5.3 | - |
451 | - | |
452 | \brief The QMarginsF class defines the four margins of a rectangle. | - |
453 | - | |
454 | QMarginsF defines a set of four margins; left, top, right and bottom, | - |
455 | that describe the size of the borders surrounding a rectangle. | - |
456 | - | |
457 | The isNull() function returns \c true only if all margins are set to zero. | - |
458 | - | |
459 | QMarginsF objects can be streamed as well as compared. | - |
460 | */ | - |
461 | - | |
462 | - | |
463 | /***************************************************************************** | - |
464 | QMarginsF member functions | - |
465 | *****************************************************************************/ | - |
466 | - | |
467 | /*! | - |
468 | \fn QMarginsF::QMarginsF() | - |
469 | - | |
470 | Constructs a margins object with all margins set to 0. | - |
471 | - | |
472 | \sa isNull() | - |
473 | */ | - |
474 | - | |
475 | /*! | - |
476 | \fn QMarginsF::QMarginsF(qreal left, qreal top, qreal right, qreal bottom) | - |
477 | - | |
478 | Constructs margins with the given \a left, \a top, \a right, \a bottom | - |
479 | - | |
480 | \sa setLeft(), setRight(), setTop(), setBottom() | - |
481 | */ | - |
482 | - | |
483 | /*! | - |
484 | \fn QMarginsF::QMarginsF(const QMargins &margins) | - |
485 | - | |
486 | Constructs margins copied from the given \a margins | - |
487 | */ | - |
488 | - | |
489 | /*! | - |
490 | \fn bool QMarginsF::isNull() const | - |
491 | - | |
492 | Returns \c true if all margins are 0; otherwise returns | - |
493 | false. | - |
494 | */ | - |
495 | - | |
496 | - | |
497 | /*! | - |
498 | \fn qreal QMarginsF::left() const | - |
499 | - | |
500 | Returns the left margin. | - |
501 | - | |
502 | \sa setLeft() | - |
503 | */ | - |
504 | - | |
505 | /*! | - |
506 | \fn qreal QMarginsF::top() const | - |
507 | - | |
508 | Returns the top margin. | - |
509 | - | |
510 | \sa setTop() | - |
511 | */ | - |
512 | - | |
513 | /*! | - |
514 | \fn qreal QMarginsF::right() const | - |
515 | - | |
516 | Returns the right margin. | - |
517 | */ | - |
518 | - | |
519 | /*! | - |
520 | \fn qreal QMarginsF::bottom() const | - |
521 | - | |
522 | Returns the bottom margin. | - |
523 | */ | - |
524 | - | |
525 | - | |
526 | /*! | - |
527 | \fn void QMarginsF::setLeft(qreal left) | - |
528 | - | |
529 | Sets the left margin to \a left. | - |
530 | */ | - |
531 | - | |
532 | /*! | - |
533 | \fn void QMarginsF::setTop(qreal Top) | - |
534 | - | |
535 | Sets the Top margin to \a Top. | - |
536 | */ | - |
537 | - | |
538 | /*! | - |
539 | \fn void QMarginsF::setRight(qreal right) | - |
540 | - | |
541 | Sets the right margin to \a right. | - |
542 | */ | - |
543 | - | |
544 | /*! | - |
545 | \fn void QMarginsF::setBottom(qreal bottom) | - |
546 | - | |
547 | Sets the bottom margin to \a bottom. | - |
548 | */ | - |
549 | - | |
550 | /*! | - |
551 | \fn bool operator==(const QMarginsF &lhs, const QMarginsF &rhs) | - |
552 | \relates QMarginsF | - |
553 | - | |
554 | Returns \c true if \a lhs and \a rhs are equal; otherwise returns \c false. | - |
555 | */ | - |
556 | - | |
557 | /*! | - |
558 | \fn bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs) | - |
559 | \relates QMarginsF | - |
560 | - | |
561 | Returns \c true if \a lhs and \a rhs are different; otherwise returns \c false. | - |
562 | */ | - |
563 | - | |
564 | /*! | - |
565 | \fn const QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) | - |
566 | \relates QMarginsF | - |
567 | - | |
568 | Returns a QMarginsF object that is the sum of the given margins, \a lhs | - |
569 | and \a rhs; each component is added separately. | - |
570 | - | |
571 | \sa QMarginsF::operator+=(), QMarginsF::operator-=() | - |
572 | */ | - |
573 | - | |
574 | /*! | - |
575 | \fn const QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) | - |
576 | \relates QMarginsF | - |
577 | - | |
578 | Returns a QMarginsF object that is formed by subtracting \a rhs from | - |
579 | \a lhs; each component is subtracted separately. | - |
580 | - | |
581 | \sa QMarginsF::operator+=(), QMarginsF::operator-=() | - |
582 | */ | - |
583 | - | |
584 | /*! | - |
585 | \fn const QMarginsF operator+(const QMarginsF &lhs, qreal rhs) | - |
586 | \relates QMarginsF | - |
587 | - | |
588 | Returns a QMarginsF object that is formed by adding \a rhs to | - |
589 | \a lhs. | - |
590 | - | |
591 | \sa QMarginsF::operator+=(), QMarginsF::operator-=() | - |
592 | */ | - |
593 | - | |
594 | /*! | - |
595 | \fn const QMarginsF operator+(qreal lhs, const QMarginsF &rhs) | - |
596 | \relates QMarginsF | - |
597 | - | |
598 | Returns a QMarginsF object that is formed by adding \a lhs to | - |
599 | \a rhs. | - |
600 | - | |
601 | \sa QMarginsF::operator+=(), QMarginsF::operator-=() | - |
602 | */ | - |
603 | - | |
604 | /*! | - |
605 | \fn const QMarginsF operator-(const QMarginsF &lhs, qreal rhs) | - |
606 | \relates QMarginsF | - |
607 | - | |
608 | Returns a QMarginsF object that is formed by subtracting \a rhs from | - |
609 | \a lhs. | - |
610 | - | |
611 | \sa QMarginsF::operator+=(), QMarginsF::operator-=() | - |
612 | */ | - |
613 | - | |
614 | /*! | - |
615 | \fn const QMarginsF operator*(const QMarginsF &lhs, qreal rhs) | - |
616 | \relates QMarginsF | - |
617 | \overload | - |
618 | - | |
619 | Returns a QMarginsF object that is formed by multiplying each component | - |
620 | of the given \a lhs margins by \a rhs factor. | - |
621 | - | |
622 | \sa QMarginsF::operator*=(), QMarginsF::operator/=() | - |
623 | */ | - |
624 | - | |
625 | /*! | - |
626 | \fn const QMarginsF operator*(qreal lhs, const QMarginsF &rhs) | - |
627 | \relates QMarginsF | - |
628 | \overload | - |
629 | - | |
630 | Returns a QMarginsF object that is formed by multiplying each component | - |
631 | of the given \a lhs margins by \a rhs factor. | - |
632 | - | |
633 | \sa QMarginsF::operator*=(), QMarginsF::operator/=() | - |
634 | */ | - |
635 | - | |
636 | /*! | - |
637 | \fn const QMarginsF operator/(const QMarginsF &lhs, qreal rhs) | - |
638 | \relates QMarginsF | - |
639 | \overload | - |
640 | - | |
641 | Returns a QMarginsF object that is formed by dividing the components of | - |
642 | the given \a lhs margins by the given \a rhs divisor. | - |
643 | - | |
644 | \sa QMarginsF::operator*=(), QMarginsF::operator/=() | - |
645 | */ | - |
646 | - | |
647 | /*! | - |
648 | \fn QMarginsF operator+(const QMarginsF &margins) | - |
649 | \relates QMarginsF | - |
650 | - | |
651 | Returns a QMargin object that is formed from all components of \a margins. | - |
652 | */ | - |
653 | - | |
654 | /*! | - |
655 | \fn QMarginsF operator-(const QMarginsF &margins) | - |
656 | \relates QMarginsF | - |
657 | - | |
658 | Returns a QMargin object that is formed by negating all components of \a margins. | - |
659 | */ | - |
660 | - | |
661 | /*! | - |
662 | \fn QMarginsF &QMarginsF::operator+=(const QMarginsF &margins) | - |
663 | - | |
664 | Add each component of \a margins to the respective component of this object | - |
665 | and returns a reference to it. | - |
666 | - | |
667 | \sa operator-=() | - |
668 | */ | - |
669 | - | |
670 | /*! | - |
671 | \fn QMarginsF &QMarginsF::operator-=(const QMarginsF &margins) | - |
672 | - | |
673 | Subtract each component of \a margins from the respective component of this object | - |
674 | and returns a reference to it. | - |
675 | - | |
676 | \sa operator+=() | - |
677 | */ | - |
678 | - | |
679 | /*! | - |
680 | \fn QMarginsF &QMarginsF::operator+=(qreal addend) | - |
681 | \overload | - |
682 | - | |
683 | Adds the \a addend to each component of this object | - |
684 | and returns a reference to it. | - |
685 | - | |
686 | \sa operator-=() | - |
687 | */ | - |
688 | - | |
689 | /*! | - |
690 | \fn QMarginsF &QMarginsF::operator-=(qreal subtrahend) | - |
691 | \overload | - |
692 | - | |
693 | Subtracts the \a subtrahend from each component of this object | - |
694 | and returns a reference to it. | - |
695 | - | |
696 | \sa operator+=() | - |
697 | */ | - |
698 | - | |
699 | /*! | - |
700 | \fn QMarginsF &QMarginsF::operator*=(qreal factor) | - |
701 | - | |
702 | Multiplies each component of this object by \a factor | - |
703 | and returns a reference to it. | - |
704 | - | |
705 | \sa operator/=() | - |
706 | */ | - |
707 | - | |
708 | /*! | - |
709 | \fn QMarginsF &QMarginsF::operator/=(qreal divisor) | - |
710 | - | |
711 | Divides each component of this object by \a divisor | - |
712 | and returns a reference to it. | - |
713 | - | |
714 | \sa operator*=() | - |
715 | */ | - |
716 | - | |
717 | /*! | - |
718 | \fn QMargins QMarginsF::toMargins() const | - |
719 | - | |
720 | Returns an integer based copy of this margins object. | - |
721 | - | |
722 | Note that the components in the returned margins will be rounded to | - |
723 | the nearest integer. | - |
724 | - | |
725 | \sa QMarginsF() | - |
726 | */ | - |
727 | - | |
728 | /***************************************************************************** | - |
729 | QMarginsF stream functions | - |
730 | *****************************************************************************/ | - |
731 | #ifndef QT_NO_DATASTREAM | - |
732 | /*! | - |
733 | \fn QDataStream &operator<<(QDataStream &stream, const QMarginsF &m) | - |
734 | \relates QMarginsF | - |
735 | - | |
736 | Writes margin \a m to the given \a stream and returns a | - |
737 | reference to the stream. | - |
738 | - | |
739 | \sa {Serializing Qt Data Types} | - |
740 | */ | - |
741 | - | |
742 | QDataStream &operator<<(QDataStream &s, const QMarginsF &m) | - |
743 | { | - |
744 | s << double(m.left()) << double(m.top()) << double(m.right()) << double(m.bottom()); | - |
745 | return s; executed 1 time by 1 test: return s; Executed by:
| 1 |
746 | } | - |
747 | - | |
748 | /*! | - |
749 | \fn QDataStream &operator>>(QDataStream &stream, QMarginsF &m) | - |
750 | \relates QMarginsF | - |
751 | - | |
752 | Reads a margin from the given \a stream into margin \a m | - |
753 | and returns a reference to the stream. | - |
754 | - | |
755 | \sa {Serializing Qt Data Types} | - |
756 | */ | - |
757 | - | |
758 | QDataStream &operator>>(QDataStream &s, QMarginsF &m) | - |
759 | { | - |
760 | double left, top, right, bottom; | - |
761 | s >> left; | - |
762 | s >> top; | - |
763 | s >> right; | - |
764 | s >> bottom; | - |
765 | m = QMarginsF(qreal(left), qreal(top), qreal(right), qreal(bottom)); | - |
766 | return s; executed 1 time by 1 test: return s; Executed by:
| 1 |
767 | } | - |
768 | #endif // QT_NO_DATASTREAM | - |
769 | - | |
770 | #ifndef QT_NO_DEBUG_STREAM | - |
771 | QDebug operator<<(QDebug dbg, const QMarginsF &m) | - |
772 | { | - |
773 | QDebugStateSaver saver(dbg); | - |
774 | dbg.nospace(); | - |
775 | dbg << "QMarginsF" << '('; | - |
776 | QtDebugUtils::formatQMargins(dbg, m); | - |
777 | dbg << ')'; | - |
778 | return dbg; never executed: return dbg; | 0 |
779 | } | - |
780 | #endif | - |
781 | - | |
782 | QT_END_NAMESPACE | - |
Source code | Switch to Preprocessed file |