tools/qmargins.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtCore module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
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 Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/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 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qmargins.h" -
43#include "qdatastream.h" -
44#include "qdebug.h" -
45 -
46QT_BEGIN_NAMESPACE -
47 -
48/*! -
49 \class QMargins -
50 \inmodule QtCore -
51 \ingroup painting -
52 \since 4.6 -
53 -
54 \brief The QMargins class defines the four margins of a rectangle. -
55 -
56 QMargin defines a set of four margins; left, top, right and bottom, -
57 that describe the size of the borders surrounding a rectangle. -
58 -
59 The isNull() function returns true only if all margins are set to zero. -
60 -
61 QMargin objects can be streamed as well as compared. -
62*/ -
63 -
64 -
65/***************************************************************************** -
66 QMargins member functions -
67 *****************************************************************************/ -
68 -
69/*! -
70 \fn QMargins::QMargins() -
71 -
72 Constructs a margins object with all margins set to 0. -
73 -
74 \sa isNull() -
75*/ -
76 -
77/*! -
78 \fn QMargins::QMargins(int left, int top, int right, int bottom) -
79 -
80 Constructs margins with the given \a left, \a top, \a right, \a bottom -
81 -
82 \sa setLeft(), setRight(), setTop(), setBottom() -
83*/ -
84 -
85/*! -
86 \fn bool QMargins::isNull() const -
87 -
88 Returns true if all margins are is 0; otherwise returns -
89 false. -
90*/ -
91 -
92 -
93/*! -
94 \fn int QMargins::left() const -
95 -
96 Returns the left margin. -
97 -
98 \sa setLeft() -
99*/ -
100 -
101/*! -
102 \fn int QMargins::top() const -
103 -
104 Returns the top margin. -
105 -
106 \sa setTop() -
107*/ -
108 -
109/*! -
110 \fn int QMargins::right() const -
111 -
112 Returns the right margin. -
113*/ -
114 -
115/*! -
116 \fn int QMargins::bottom() const -
117 -
118 Returns the bottom margin. -
119*/ -
120 -
121 -
122/*! -
123 \fn void QMargins::setLeft(int left) -
124 -
125 Sets the left margin to \a left. -
126*/ -
127 -
128/*! -
129 \fn void QMargins::setTop(int Top) -
130 -
131 Sets the Top margin to \a Top. -
132*/ -
133 -
134/*! -
135 \fn void QMargins::setRight(int right) -
136 -
137 Sets the right margin to \a right. -
138*/ -
139 -
140/*! -
141 \fn void QMargins::setBottom(int bottom) -
142 -
143 Sets the bottom margin to \a bottom. -
144*/ -
145 -
146/*! -
147 \fn bool operator==(const QMargins &m1, const QMargins &m2) -
148 \relates QMargins -
149 -
150 Returns true if \a m1 and \a m2 are equal; otherwise returns false. -
151*/ -
152 -
153/*! -
154 \fn bool operator!=(const QMargins &m1, const QMargins &m2) -
155 \relates QMargins -
156 -
157 Returns true if \a m1 and \a m2 are different; otherwise returns false. -
158*/ -
159 -
160/***************************************************************************** -
161 QMargins stream functions -
162 *****************************************************************************/ -
163#ifndef QT_NO_DATASTREAM -
164/*! -
165 \fn QDataStream &operator<<(QDataStream &stream, const QMargins &m) -
166 \relates QMargins -
167 -
168 Writes margin \a m to the given \a stream and returns a -
169 reference to the stream. -
170 -
171 \sa {Serializing Qt Data Types} -
172*/ -
173 -
174QDataStream &operator<<(QDataStream &s, const QMargins &m) -
175{ -
176 s << m.left() << m.top() << m.right() << m.bottom();
executed (the execution status of this line is deduced): s << m.left() << m.top() << m.right() << m.bottom();
-
177 return s;
executed: return s;
Execution Count:1
1
178} -
179 -
180/*! -
181 \fn QDataStream &operator>>(QDataStream &stream, QMargins &m) -
182 \relates QMargins -
183 -
184 Reads a margin from the given \a stream into margin \a m -
185 and returns a reference to the stream. -
186 -
187 \sa {Serializing Qt Data Types} -
188*/ -
189 -
190QDataStream &operator>>(QDataStream &s, QMargins &m) -
191{ -
192 int left, top, right, bottom;
executed (the execution status of this line is deduced): int left, top, right, bottom;
-
193 s >> left; m.setLeft(left);
executed (the execution status of this line is deduced): s >> left; m.setLeft(left);
-
194 s >> top; m.setTop(top);
executed (the execution status of this line is deduced): s >> top; m.setTop(top);
-
195 s >> right; m.setRight(right);
executed (the execution status of this line is deduced): s >> right; m.setRight(right);
-
196 s >> bottom; m.setBottom(bottom);
executed (the execution status of this line is deduced): s >> bottom; m.setBottom(bottom);
-
197 return s;
executed: return s;
Execution Count:1
1
198} -
199#endif // QT_NO_DATASTREAM -
200 -
201#ifndef QT_NO_DEBUG_STREAM -
202QDebug operator<<(QDebug dbg, const QMargins &m) { -
203 dbg.nospace() << "QMargins(" << m.left() << ", "
never executed (the execution status of this line is deduced): dbg.nospace() << "QMargins(" << m.left() << ", "
-
204 << m.top() << ", " << m.right() << ", " << m.bottom() << ')';
never executed (the execution status of this line is deduced): << m.top() << ", " << m.right() << ", " << m.bottom() << ')';
-
205 return dbg.space();
never executed: return dbg.space();
0
206} -
207#endif -
208 -
209QT_END_NAMESPACE -
210 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial