CopperSpice API
1.7.2

The QPoint class defines a point in the plane using integer precision. More...
Public Methods  
QPoint ()  
QPoint (int xPos, int yPos)  
bool  isNull () const 
int  manhattanLength () const 
QPoint &  operator*= (double c) 
QPoint &  operator*= (float c) 
QPoint &  operator*= (int c) 
QPoint &  operator+= (const QPoint &p) 
QPoint &  operator= (const QPoint &p) 
QPoint &  operator/= (qreal c) 
int &  rx () 
int &  ry () 
void  setX (int xPos) 
void  setY (int yPos) 
int  x () const 
int  y () const 
Friends  
bool  operator!= (const QPoint &, const QPoint &) 
const QPoint  operator* (const QPoint &, double) 
const QPoint  operator* (const QPoint &, float) 
const QPoint  operator* (const QPoint &, int) 
const QPoint  operator* (double, const QPoint &) 
const QPoint  operator* (float, const QPoint &) 
const QPoint  operator* (int, const QPoint &) 
const QPoint  operator+ (const QPoint &, const QPoint &) 
const QPoint  operator (const QPoint &) 
const QPoint  operator (const QPoint &, const QPoint &) 
const QPoint  operator/ (const QPoint &, qreal) 
bool  operator== (const QPoint &, const QPoint &) 
class  QTransform 
Related Functions  
These are not member functions  
QDataStream &  operator<< (QDataStream &stream, const QPoint &point) 
QDataStream &  operator>> (QDataStream &stream, QPoint &point) 
The QPoint class defines a point in the plane using integer precision.
A point is specified by a x coordinate and an y coordinate which can be accessed using the x() and y() functions. The isNull() function returns true if both x and y are set to 0. The coordinates can be set (or altered) using the setX() and setY() functions, or alternatively the rx() and ry() functions which return references to the coordinates (allowing direct manipulation).
Given a point p, the following statements are all equivalent:
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 int
or a qreal
.
In addition, the QPoint class provides the manhattanLength() 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.

inline 
Constructs a null point, i.e. with coordinates (0, 0)

inline 

inline 
Returns true if both the x and y coordinates are set to 0, otherwise returns false.
int QPoint::manhattanLength  (  )  const 
Returns the sum of the absolute values of x() and y(), traditionally known as the "Manhattan length" of the vector from the origin to the point.
This is a useful calculation to approximate the true length.

inline 
Multiplies this point's coordinates by the given factor, and returns a reference to this point. The result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

inline 
Multiplies this point's coordinates by the given factor, and returns a reference to this point. The result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

inline 
Multiplies this point's coordinates by the given factor, and returns a reference to this point.

inline 
Adds the given point to this point and returns a reference to this point.

inline 
Subtracts the given point from this point and returns a reference to this point.

inline 
Divides both x and y by the given divisor, and returns a reference to this point.
Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

inline 

inline 

inline 

inline 

friend 
Returns true if p1 and p2 are not equal, otherwise returns false.

friend 
Returns a copy of the given point multiplied by the given factor.
The result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

friend 
Returns a copy of the given point multiplied by the given factor.
The result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

friend 
Returns a copy of the given point multiplied by the given factor.

friend 
Returns a copy of the given point multiplied by the given factor.

friend 
Returns a copy of the given point multiplied by the given factor.

friend 
Returns a copy of the given point multiplied by the given factor.

friend 
Returns a QPoint object that is the sum of the given points, p1 and p2, each component is added separately.

friend 
Returns a QPoint object that is formed by changing the sign of both components of the given point.
Equivalent to QPoint(0,0)  point
.

friend 
Returns a QPoint object that is formed by subtracting p2 from p1, each component is subtracted separately.

friend 
Returns the QPoint formed by dividing both components of the given point by the given divisor.
Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

related 
Writes the given point to the given stream and returns a reference to the stream.
Refer to Serializing Data Types for additional information.

friend 
Returns true if p1 and p2 are equal, otherwise returns false.

related 
Reads a point from the given stream into the given point and returns a reference to the stream.
Refer to Serializing Data Types for additional information.