The QPoint class defines a point in the plane. More...
#include <qpoint.h>
A point is specified by an x coordinate and a y coordinate.
The coordinate type is QCOORD (defined in qwindowdefs.h as short).
The minimum value of QCOORD is QCOORD_MIN (-32768) and the maximum
value is QCOORD_MAX (32767).
We have defined many operator functions that make arithmetic on points simple and intuitive.
Example:
QPoint p( 1, 2 ); QPoint q( -8, 5 ); QPoint r( 9, 7 ); QPoint x = 2*p + (q-r)*5.5 - (r+p/1.5);
Examples: tictac/tictac.cpp table/table.cpp forever/forever.cpp connect/connect.cpp drawdemo/drawdemo.cpp xform/xform.cpp aclock/aclock.cpp
Constructs a point with undefined x and y values.
Constructs a point with the x value xpos and y value ypos.
Returns TRUE if both the x value and the y value are 0.
Multiplies both x and y with c, and return a reference to this point.
Example:
QPoint p( -1, 4 ); p *= 2.5; // p becomes (-3,10)
Note that the result is truncated.
Multiplies both x and y with c, and return a reference to this point.
Example:
QPoint p( -1, 4 ); p *= 2; // p becomes (-2,8)
Adds p to the point and returns a reference to this point.
Example:
QPoint p( 3, 7 ); QPoint q( -1, 4 ); p += q; // p becomes (2,11)
Subtracts p from the point and returns a reference to this point.
Example:
QPoint p( 3, 7 ); QPoint q( -1, 4 ); p -= q; // p becomes (4,3)
Divides both x and y by c, and return a reference to this point.
Example:
QPoint p( -3, 10 ); p /= 2.5; // p becomes (-1,4)
Note that the result is truncated.
Divides both x and y by c, and return a reference to this point.
Example:
QPoint p( -2, 8 ); p /= 2; // p becomes (-1,4)
Returns a reference to the x coordinate of the point.
Using a reference makes it possible to directly manipulate x.
Example:
QPoint p( 1, 2 ); p.rx()--; // p becomes (0,2)
See also: ry().
Returns a reference to the y coordinate of the point.
Using a reference makes it possible to directly manipulate y.
Example:
QPoint p( 1, 2 ); p.ry()++; // p becomes (1,3)
See also: rx().
Sets the x coordinate of the point to x.
See also: setY().
Sets the y coordinate of the point to y.
See also: setX().
Returns the x coordinate of the point.
See also: y().
Examples: table/table.cpp drawdemo/drawdemo.cpp aclock/aclock.cpp
Returns the y coordinate of the point.
See also: x().
Examples: table/table.cpp drawdemo/drawdemo.cpp aclock/aclock.cpp
Returns TRUE if p1 and p2 are equal, or FALSE if they are different.
Returns TRUE if p1 and p2 are different, or FALSE if they are equal.
Returns the sum of p1 and p2; each component is added separately.
Returns p2 subtracted from p1; each component is subtracted separately.
Multiplies both of p's components by c and returns the result.
Multiplies both of p's components by c and returns the result.
Multiplies both of p's components by c and returns the result.
Multiplies both of p's components by c and returns the result.
Returns p where x and y have opposite signs.
Divides both of p's components by c and returns the result.
Divides both of p's components by c and returns the result.
Note that the result is truncated.
Writes a QPoint to the stream and returns a reference to the stream.
Serialization format: [x (INT16), y (INT16)].
Reads a QPoint from the stream and returns a reference to the stream.
Search the documentation, FAQ, qt-interest archive and more (uses
www.troll.no):
This file is part of the Qt toolkit, copyright © 1995-98 Troll Tech, all rights reserved.
It was generated from the following files:
Copyright © 1998 Troll Tech | Trademarks | Qt version 1.42
|