File: qpoint.html

package info (click to toggle)
qt4-x11 4%3A4.8.2%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 701,696 kB
  • sloc: cpp: 2,686,179; ansic: 375,485; python: 25,859; sh: 19,349; xml: 17,091; perl: 14,765; yacc: 5,383; asm: 5,038; makefile: 1,259; lex: 555; ruby: 526; objc: 347; cs: 112; pascal: 112; php: 54; sed: 34
file content (317 lines) | stat: -rw-r--r-- 29,314 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qpoint.cpp -->
  <title>Qt 4.8: QPoint Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtcore.html">QtCore</a></li>
<li>QPoint</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QPoint Class Reference</h1>
<!-- $$$QPoint-brief -->
<p>The QPoint class defines a point in the plane using integer precision. <a href="#details">More...</a></p>
<!-- @@@QPoint -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QPoint&gt;</span></pre><ul>
<li><a href="qpoint-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#QPoint">QPoint</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#QPoint-2">QPoint</a></b> ( int <i>x</i>, int <i>y</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#isNull">isNull</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#manhattanLength">manhattanLength</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#rx">rx</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#ry">ry</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#setX">setX</a></b> ( int <i>x</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#setY">setY</a></b> ( int <i>y</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#x">x</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#y">y</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-eq">operator*=</a></b> ( float <i>factor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-eq-2">operator*=</a></b> ( double <i>factor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-eq-3">operator*=</a></b> ( int <i>factor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2b-eq">operator+=</a></b> ( const QPoint &amp; <i>point</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator--eq">operator-=</a></b> ( const QPoint &amp; <i>point</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2f-eq">operator/=</a></b> ( qreal <i>divisor</i> )</td></tr>
</table>
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-not-eq-15">operator!=</a></b> ( const QPoint &amp; <i>p1</i>, const QPoint &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-57">operator*</a></b> ( float <i>factor</i>, const QPoint &amp; <i>point</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-58">operator*</a></b> ( double <i>factor</i>, const QPoint &amp; <i>point</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-59">operator*</a></b> ( int <i>factor</i>, const QPoint &amp; <i>point</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-15">operator*</a></b> ( const QPoint &amp; <i>point</i>, float <i>factor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-16">operator*</a></b> ( const QPoint &amp; <i>point</i>, double <i>factor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-17">operator*</a></b> ( const QPoint &amp; <i>point</i>, int <i>factor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2b-7">operator+</a></b> ( const QPoint &amp; <i>p1</i>, const QPoint &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator--6">operator-</a></b> ( const QPoint &amp; <i>p1</i>, const QPoint &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator--22">operator-</a></b> ( const QPoint &amp; <i>point</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2f-3">operator/</a></b> ( const QPoint &amp; <i>point</i>, qreal <i>divisor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-lt-lt-40">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>stream</i>, const QPoint &amp; <i>point</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-eq-eq-20">operator==</a></b> ( const QPoint &amp; <i>p1</i>, const QPoint &amp; <i>p2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-gt-gt-22">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QPoint &amp; <i>point</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QPoint-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QPoint class defines a point in the plane using integer precision.</p>
<p>A point is specified by a x coordinate and an y coordinate which can be accessed using the <a href="qpoint.html#x">x</a>() and <a href="qpoint.html#y">y</a>() functions. The <a href="qpoint.html#isNull">isNull</a>() function returns true if both x and y are set to 0. The coordinates can be set (or altered) using the <a href="qpoint.html#setX">setX</a>() and <a href="qpoint.html#setY">setY</a>() functions, or alternatively the <a href="qpoint.html#rx">rx</a>() and <a href="qpoint.html#ry">ry</a>() functions which return references to the coordinates (allowing direct manipulation).</p>
<p>Given a point <i>p</i>, the following statements are all equivalent:</p>
<pre class="cpp"> <span class="type">QPoint</span> p;

 p<span class="operator">.</span><a href="qpoint.html#setX">setX</a>(p<span class="operator">.</span>x() <span class="operator">+</span> <span class="number">1</span>);
 p <span class="operator">+</span><span class="operator">=</span> <span class="type">QPoint</span>(<span class="number">1</span><span class="operator">,</span> <span class="number">0</span>);
 p<span class="operator">.</span><a href="qpoint.html#rx">rx</a>()<span class="operator">+</span><span class="operator">+</span>;</pre>
<p>A QPoint object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A QPoint object can also be divided or multiplied by an <tt>int</tt> or a <tt>qreal</tt>.</p>
<p>In addition, the QPoint class provides the <a href="qpoint.html#manhattanLength">manhattanLength</a>() function which gives an inexpensive approximation of the length of the QPoint object interpreted as a vector. Finally, QPoint objects can be streamed as well as compared.</p>
</div>
<p><b>See also </b><a href="qpointf.html">QPointF</a> and <a href="qpolygon.html">QPolygon</a>.</p>
<!-- @@@QPoint -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QPoint[overload1]$$$QPoint -->
<h3 class="fn"><a name="QPoint"></a>QPoint::<span class="name">QPoint</span> ()</h3>
<p>Constructs a null point, i.e&#x2e; with coordinates (0, 0)</p>
<p><b>See also </b><a href="qpoint.html#isNull">isNull</a>().</p>
<!-- @@@QPoint -->
<!-- $$$QPoint$$$QPointintint -->
<h3 class="fn"><a name="QPoint-2"></a>QPoint::<span class="name">QPoint</span> ( <span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i> )</h3>
<p>Constructs a point with the given coordinates (<i>x</i>, <i>y</i>).</p>
<p><b>See also </b><a href="qpoint.html#setX">setX</a>() and <a href="qpoint.html#setY">setY</a>().</p>
<!-- @@@QPoint -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn"><a name="isNull"></a><span class="type">bool</span> QPoint::<span class="name">isNull</span> () const</h3>
<p>Returns true if both the x and y coordinates are set to 0, otherwise returns false.</p>
<!-- @@@isNull -->
<!-- $$$manhattanLength[overload1]$$$manhattanLength -->
<h3 class="fn"><a name="manhattanLength"></a><span class="type">int</span> QPoint::<span class="name">manhattanLength</span> () const</h3>
<p>Returns the sum of the absolute values of <a href="qpoint.html#x">x</a>() and <a href="qpoint.html#y">y</a>(), traditionally known as the &quot;Manhattan length&quot; of the vector from the origin to the point. For example:</p>
<pre class="cpp"> <span class="type"><a href="qpoint.html">QPoint</a></span> oldPosition;

 MyWidget<span class="operator">::</span>mouseMoveEvent(<span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> <span class="operator">*</span>event)
 {
     <span class="type"><a href="qpoint.html">QPoint</a></span> point <span class="operator">=</span> event<span class="operator">-</span><span class="operator">&gt;</span>pos() <span class="operator">-</span> oldPosition;
     <span class="keyword">if</span> (point<span class="operator">.</span>manhattanLength() <span class="operator">&gt;</span> <span class="number">3</span>)
         <span class="comment">// the mouse has moved more than 3 pixels since the oldPosition</span>
 }</pre>
<p>This is a useful, and quick to calculate, approximation to the true length:</p>
<pre class="cpp"> <span class="type">double</span> trueLength <span class="operator">=</span> sqrt(pow(x()<span class="operator">,</span> <span class="number">2</span>) <span class="operator">+</span> pow(y()<span class="operator">,</span> <span class="number">2</span>));</pre>
<p>The tradition of &quot;Manhattan length&quot; arises because such distances apply to travelers who can only travel on a rectangular grid, like the streets of Manhattan.</p>
<!-- @@@manhattanLength -->
<!-- $$$rx[overload1]$$$rx -->
<h3 class="fn"><a name="rx"></a><span class="type">int</span> &amp; QPoint::<span class="name">rx</span> ()</h3>
<p>Returns a reference to the x coordinate of this point.</p>
<p>Using a reference makes it possible to directly manipulate x. For example:</p>
<pre class="cpp"> <span class="type"><a href="qpoint.html">QPoint</a></span> p(<span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
 p<span class="operator">.</span>rx()<span class="operator">-</span><span class="operator">-</span>;   <span class="comment">// p becomes (0, 2)</span></pre>
<p><b>See also </b><a href="qpoint.html#x">x</a>() and <a href="qpoint.html#setX">setX</a>().</p>
<!-- @@@rx -->
<!-- $$$ry[overload1]$$$ry -->
<h3 class="fn"><a name="ry"></a><span class="type">int</span> &amp; QPoint::<span class="name">ry</span> ()</h3>
<p>Returns a reference to the y coordinate of this point.</p>
<p>Using a reference makes it possible to directly manipulate y. For example:</p>
<pre class="cpp"> <span class="type"><a href="qpoint.html">QPoint</a></span> p(<span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
 p<span class="operator">.</span>ry()<span class="operator">+</span><span class="operator">+</span>;   <span class="comment">// p becomes (1, 3)</span></pre>
<p><b>See also </b><a href="qpoint.html#y">y</a>() and <a href="qpoint.html#setY">setY</a>().</p>
<!-- @@@ry -->
<!-- $$$setX[overload1]$$$setXint -->
<h3 class="fn"><a name="setX"></a><span class="type">void</span> QPoint::<span class="name">setX</span> ( <span class="type">int</span> <i>x</i> )</h3>
<p>Sets the x coordinate of this point to the given <i>x</i> coordinate.</p>
<p><b>See also </b><a href="qpoint.html#x">x</a>() and <a href="qpoint.html#setY">setY</a>().</p>
<!-- @@@setX -->
<!-- $$$setY[overload1]$$$setYint -->
<h3 class="fn"><a name="setY"></a><span class="type">void</span> QPoint::<span class="name">setY</span> ( <span class="type">int</span> <i>y</i> )</h3>
<p>Sets the y coordinate of this point to the given <i>y</i> coordinate.</p>
<p><b>See also </b><a href="qpoint.html#y">y</a>() and <a href="qpoint.html#setX">setX</a>().</p>
<!-- @@@setY -->
<!-- $$$x[overload1]$$$x -->
<h3 class="fn"><a name="x"></a><span class="type">int</span> QPoint::<span class="name">x</span> () const</h3>
<p>Returns the x coordinate of this point.</p>
<p><b>See also </b><a href="qpoint.html#setX">setX</a>() and <a href="qpoint.html#rx">rx</a>().</p>
<!-- @@@x -->
<!-- $$$y[overload1]$$$y -->
<h3 class="fn"><a name="y"></a><span class="type">int</span> QPoint::<span class="name">y</span> () const</h3>
<p>Returns the y coordinate of this point.</p>
<p><b>See also </b><a href="qpoint.html#setY">setY</a>() and <a href="qpoint.html#ry">ry</a>().</p>
<!-- @@@y -->
<!-- $$$operator*=[overload1]$$$operator*=float -->
<h3 class="fn"><a name="operator-2a-eq"></a><span class="type">QPoint</span> &amp; QPoint::<span class="name">operator*=</span> ( <span class="type">float</span> <i>factor</i> )</h3>
<p>Multiplies this point's coordinates by the given <i>factor</i>, and returns a reference to this point.</p>
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qpoint.html#operator-2f-eq">operator/=</a>().</p>
<!-- @@@operator*= -->
<!-- $$$operator*=$$$operator*=double -->
<h3 class="fn"><a name="operator-2a-eq-2"></a><span class="type">QPoint</span> &amp; QPoint::<span class="name">operator*=</span> ( <span class="type">double</span> <i>factor</i> )</h3>
<p>Multiplies this point's coordinates by the given <i>factor</i>, and returns a reference to this point. For example:</p>
<pre class="cpp"> <span class="type"><a href="qpoint.html">QPoint</a></span> p(<span class="operator">-</span><span class="number">1</span><span class="operator">,</span> <span class="number">4</span>);
 p <span class="operator">*</span><span class="operator">=</span> <span class="number">2.5</span>;    <span class="comment">// p becomes (-3, 10)</span></pre>
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qpoint.html#operator-2f-eq">operator/=</a>().</p>
<!-- @@@operator*= -->
<!-- $$$operator*=$$$operator*=int -->
<h3 class="fn"><a name="operator-2a-eq-3"></a><span class="type">QPoint</span> &amp; QPoint::<span class="name">operator*=</span> ( <span class="type">int</span> <i>factor</i> )</h3>
<p>Multiplies this point's coordinates by the given <i>factor</i>, and returns a reference to this point.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qpoint.html#operator-2f-eq">operator/=</a>().</p>
<!-- @@@operator*= -->
<!-- $$$operator+=[overload1]$$$operator+=constQPoint& -->
<h3 class="fn"><a name="operator-2b-eq"></a><span class="type">QPoint</span> &amp; QPoint::<span class="name">operator+=</span> ( const <span class="type">QPoint</span> &amp; <i>point</i> )</h3>
<p>Adds the given <i>point</i> to this point and returns a reference to this point. For example:</p>
<pre class="cpp"> <span class="type"><a href="qpoint.html">QPoint</a></span> p( <span class="number">3</span><span class="operator">,</span> <span class="number">7</span>);
 <span class="type"><a href="qpoint.html">QPoint</a></span> q(<span class="operator">-</span><span class="number">1</span><span class="operator">,</span> <span class="number">4</span>);
 p <span class="operator">+</span><span class="operator">=</span> q;    <span class="comment">// p becomes (2, 11)</span></pre>
<p><b>See also </b><a href="qpoint.html#operator--eq">operator-=</a>().</p>
<!-- @@@operator+= -->
<!-- $$$operator-=[overload1]$$$operator-=constQPoint& -->
<h3 class="fn"><a name="operator--eq"></a><span class="type">QPoint</span> &amp; QPoint::<span class="name">operator-=</span> ( const <span class="type">QPoint</span> &amp; <i>point</i> )</h3>
<p>Subtracts the given <i>point</i> from this point and returns a reference to this point. For example:</p>
<pre class="cpp"> <span class="type"><a href="qpoint.html">QPoint</a></span> p( <span class="number">3</span><span class="operator">,</span> <span class="number">7</span>);
 <span class="type"><a href="qpoint.html">QPoint</a></span> q(<span class="operator">-</span><span class="number">1</span><span class="operator">,</span> <span class="number">4</span>);
 p <span class="operator">-</span><span class="operator">=</span> q;    <span class="comment">// p becomes (4, 3)</span></pre>
<p><b>See also </b><a href="qpoint.html#operator-2b-eq">operator+=</a>().</p>
<!-- @@@operator-= -->
<!-- $$$operator/=[overload1]$$$operator/=qreal -->
<h3 class="fn"><a name="operator-2f-eq"></a><span class="type">QPoint</span> &amp; QPoint::<span class="name">operator/=</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>divisor</i> )</h3>
<p>This is an overloaded function.</p>
<p>Divides both x and y by the given <i>divisor</i>, and returns a reference to this point. For example:</p>
<pre class="cpp"> <span class="type"><a href="qpoint.html">QPoint</a></span> p(<span class="operator">-</span><span class="number">3</span><span class="operator">,</span> <span class="number">10</span>);
 p <span class="operator">/</span><span class="operator">=</span> <span class="number">2.5</span>;           <span class="comment">// p becomes (-1, 4)</span></pre>
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
<p><b>See also </b><a href="qpoint.html#operator-2a-eq">operator*=</a>().</p>
<!-- @@@operator/= -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator!=$$$operator!=constQPoint&constQPoint& -->
<h3 class="fn"><a name="operator-not-eq-15"></a><span class="type">bool</span> <span class="name">operator!=</span> ( const <span class="type">QPoint</span> &amp; <i>p1</i>, const <span class="type">QPoint</span> &amp; <i>p2</i> )</h3>
<p>Returns true if <i>p1</i> and <i>p2</i> are not equal; otherwise returns false.</p>
<!-- @@@operator!= -->
<!-- $$$operator*$$$operator*floatconstQPoint& -->
<h3 class="fn"><a name="operator-2a-57"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( <span class="type">float</span> <i>factor</i>, const <span class="type">QPoint</span> &amp; <i>point</i> )</h3>
<p>This is an overloaded function.</p>
<p>Returns a copy of the given <i>point</i> multiplied by the given <i>factor</i>.</p>
<p>This function was introduced in Qt 4.8.</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*doubleconstQPoint& -->
<h3 class="fn"><a name="operator-2a-58"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( <span class="type">double</span> <i>factor</i>, const <span class="type">QPoint</span> &amp; <i>point</i> )</h3>
<p>This is an overloaded function.</p>
<p>Returns a copy of the given <i>point</i> multiplied by the given <i>factor</i>.</p>
<p>This function was introduced in Qt 4.8.</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*intconstQPoint& -->
<h3 class="fn"><a name="operator-2a-59"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( <span class="type">int</span> <i>factor</i>, const <span class="type">QPoint</span> &amp; <i>point</i> )</h3>
<p>This is an overloaded function.</p>
<p>Returns a copy of the given <i>point</i> multiplied by the given <i>factor</i>.</p>
<p>This function was introduced in Qt 4.8.</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPoint&float -->
<h3 class="fn"><a name="operator-2a-15"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( const <span class="type">QPoint</span> &amp; <i>point</i>, <span class="type">float</span> <i>factor</i> )</h3>
<p>Returns a copy of the given <i>point</i> multiplied by the given <i>factor</i>.</p>
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qpoint.html#operator-2a-eq">QPoint::operator*=</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPoint&double -->
<h3 class="fn"><a name="operator-2a-16"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( const <span class="type">QPoint</span> &amp; <i>point</i>, <span class="type">double</span> <i>factor</i> )</h3>
<p>Returns a copy of the given <i>point</i> multiplied by the given <i>factor</i>.</p>
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qpoint.html#operator-2a-eq">QPoint::operator*=</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPoint&int -->
<h3 class="fn"><a name="operator-2a-17"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( const <span class="type">QPoint</span> &amp; <i>point</i>, <span class="type">int</span> <i>factor</i> )</h3>
<p>Returns a copy of the given <i>point</i> multiplied by the given <i>factor</i>.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qpoint.html#operator-2a-eq">QPoint::operator*=</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator+$$$operator+constQPoint&constQPoint& -->
<h3 class="fn"><a name="operator-2b-7"></a>const <span class="type">QPoint</span> <span class="name">operator+</span> ( const <span class="type">QPoint</span> &amp; <i>p1</i>, const <span class="type">QPoint</span> &amp; <i>p2</i> )</h3>
<p>Returns a <a href="qpoint.html">QPoint</a> object that is the sum of the given points, <i>p1</i> and <i>p2</i>; each component is added separately.</p>
<p><b>See also </b><a href="qpoint.html#operator-2b-eq">QPoint::operator+=</a>().</p>
<!-- @@@operator+ -->
<!-- $$$operator-$$$operator-constQPoint&constQPoint& -->
<h3 class="fn"><a name="operator--6"></a>const <span class="type">QPoint</span> <span class="name">operator-</span> ( const <span class="type">QPoint</span> &amp; <i>p1</i>, const <span class="type">QPoint</span> &amp; <i>p2</i> )</h3>
<p>Returns a <a href="qpoint.html">QPoint</a> object that is formed by subtracting <i>p2</i> from <i>p1</i>; each component is subtracted separately.</p>
<p><b>See also </b><a href="qpoint.html#operator--eq">QPoint::operator-=</a>().</p>
<!-- @@@operator- -->
<!-- $$$operator-$$$operator-constQPoint& -->
<h3 class="fn"><a name="operator--22"></a>const <span class="type">QPoint</span> <span class="name">operator-</span> ( const <span class="type">QPoint</span> &amp; <i>point</i> )</h3>
<p>This is an overloaded function.</p>
<p>Returns a <a href="qpoint.html">QPoint</a> object that is formed by changing the sign of both components of the given <i>point</i>.</p>
<p>Equivalent to <tt>QPoint(0,0) - point</tt>.</p>
<!-- @@@operator- -->
<!-- $$$operator/$$$operator/constQPoint&qreal -->
<h3 class="fn"><a name="operator-2f-3"></a>const <span class="type">QPoint</span> <span class="name">operator/</span> ( const <span class="type">QPoint</span> &amp; <i>point</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>divisor</i> )</h3>
<p>Returns the <a href="qpoint.html">QPoint</a> formed by dividing both components of the given <i>point</i> by the given <i>divisor</i>.</p>
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
<p><b>See also </b><a href="qpoint.html#operator-2f-eq">QPoint::operator/=</a>().</p>
<!-- @@@operator/ -->
<!-- $$$operator<<$$$operator<<QDataStream&constQPoint& -->
<h3 class="fn"><a name="operator-lt-lt-40"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&lt;&lt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, const <span class="type">QPoint</span> &amp; <i>point</i> )</h3>
<p>Writes the given <i>point</i> to the given <i>stream</i> and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator==$$$operator==constQPoint&constQPoint& -->
<h3 class="fn"><a name="operator-eq-eq-20"></a><span class="type">bool</span> <span class="name">operator==</span> ( const <span class="type">QPoint</span> &amp; <i>p1</i>, const <span class="type">QPoint</span> &amp; <i>p2</i> )</h3>
<p>Returns true if <i>p1</i> and <i>p2</i> are equal; otherwise returns false.</p>
<!-- @@@operator== -->
<!-- $$$operator>>$$$operator>>QDataStream&QPoint& -->
<h3 class="fn"><a name="operator-gt-gt-22"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&gt;&gt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, <span class="type">QPoint</span> &amp; <i>point</i> )</h3>
<p>Reads a point from the given <i>stream</i> into the given <i>point</i> and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
</div>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2012 Nokia Corporation and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>