CopperSpice API
1.9.2
|
The QPointF class defines a point in the plane using floating point precision. More...
Public Methods | |
QPointF () | |
QPointF (const QPoint &point) | |
QPointF (qreal xPos, qreal yPos) | |
bool | isNull () const |
qreal | manhattanLength () const |
QPointF & | operator*= (qreal factor) |
QPointF & | operator+= (const QPointF &point) |
QPointF & | operator-= (const QPointF &point) |
QPointF & | operator/= (qreal factor) |
qreal & | rx () |
qreal & | ry () |
void | setX (qreal xPos) |
void | setY (qreal yPos) |
QPoint | toPoint () const |
qreal | x () const |
qreal | y () const |
Friends | |
bool | operator!= (const QPointF &point1, const QPointF &point2) |
const QPointF | operator* (const QPointF &point, qreal factor) |
const QPointF | operator* (qreal factor, const QPointF &point) |
const QPointF | operator+ (const QPointF &point1, const QPointF &point2) |
const QPointF | operator- (const QPointF &point) |
const QPointF | operator- (const QPointF &point1, const QPointF &point2) |
const QPointF | operator/ (const QPointF &point, qreal factor) |
bool | operator== (const QPointF &point1, const QPointF &point2) |
class | QMatrix |
class | QTransform |
Related Functions | |
These are not member functions | |
QDataStream & | operator<< (QDataStream &stream, const QPointF &pointF) |
QDataStream & | operator>> (QDataStream &stream, QPointF &pointF) |
The QPointF class defines a point in the plane using floating point precision.
A point is specified by a x coordinate and an y coordinate which can be accessed using the x() and y() functions. The coordinates of the point are specified using floating point numbers for accuracy. The isNull() function returns true if both x and y are set to 0.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 QPointF object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A QPointF object can also be divided or multiplied by an int
or a qreal
.
In addition, the QPointF class provides a constructor converting a QPoint object into a QPointF object, and a corresponding toPoint() function which returns a QPoint copy of this point. Finally, QPointF objects can be streamed as well as compared.
|
inline |
Constructs a null point, i.e. with coordinates (0.0, 0.0)
|
inline |
Constructs a copy of the given point.
|
inline |
Returns true if both the x and y coordinates are set to +0.0, otherwise returns false.
Since this method treats +0.0 and -0.0 differently, points with zero-valued coordinates where either or both values have a negative sign are not defined to be null points.
qreal QPointF::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.
|
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 factor, and returns a reference to this point.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
Returns true if point1 is not equal to point2, otherwise returns false.
|
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 QPointF object that is the sum of the given points, point1 and point2, each component is added separately.
|
friend |
Returns a QPointF object that is formed by changing the sign of both components of the given point.
Equivalent to QPointF(0,0) - point
.
|
friend |
Returns a QPointF object that is formed by subtracting point2 from point1, each component is subtracted separately.
|
friend |
Returns the QPointF object formed by dividing both components of the given point by the given factor.
|
related |
Writes the given pointF to the stream. Returns a reference to the stream.
Refer to Serializing Data Types for additional information.
|
friend |
Returns true if point1 is equal to point2, otherwise returns false.
|
related |
Reads from the stream into the given pointF. Returns a reference to the stream.
Refer to Serializing Data Types for additional information.