QtBase
v6.3.1
|
The QPointF class defines a point in the plane using floating point precision. More...
#include <qpoint.h>
Public Member Functions | |
constexpr | QPointF () noexcept |
constexpr | QPointF (const QPoint &p) noexcept |
constexpr | QPointF (qreal xpos, qreal ypos) noexcept |
constexpr qreal | manhattanLength () const |
bool | isNull () const noexcept |
constexpr qreal | x () const noexcept |
constexpr qreal | y () const noexcept |
constexpr void | setX (qreal x) noexcept |
constexpr void | setY (qreal y) noexcept |
constexpr QPointF | transposed () const noexcept |
constexpr qreal & | rx () noexcept |
constexpr qreal & | ry () noexcept |
constexpr QPointF & | operator+= (const QPointF &p) |
constexpr QPointF & | operator-= (const QPointF &p) |
constexpr QPointF & | operator*= (qreal c) |
constexpr QPointF & | operator/= (qreal c) |
constexpr QPoint | toPoint () const |
Static Public Member Functions | |
constexpr static qreal | dotProduct (const QPointF &p1, const QPointF &p2) |
Friends | |
class | QTransform |
QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE constexpr friend bool | operator== (const QPointF &p1, const QPointF &p2) |
constexpr friend bool | operator!= (const QPointF &p1, const QPointF &p2) |
QT_WARNING_POP constexpr friend QPointF | operator+ (const QPointF &p1, const QPointF &p2) |
constexpr friend QPointF | operator- (const QPointF &p1, const QPointF &p2) |
constexpr friend QPointF | operator* (const QPointF &p, qreal c) |
constexpr friend QPointF | operator* (qreal c, const QPointF &p) |
constexpr friend QPointF | operator+ (const QPointF &p) |
constexpr friend QPointF | operator- (const QPointF &p) |
constexpr friend QPointF | operator/ (const QPointF &p, qreal divisor) |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &stream, const QPointF &point) |
QDataStream & | operator>> (QDataStream &stream, QPointF &point) |
The QPointF class defines a point in the plane using floating point precision.
\inmodule QtCore
\reentrant
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 finite 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.
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlineconstexpr |
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.
Definition at line 351 of file qpoint.h.
Multiplies this point's coordinates by the given finite factor, and returns a reference to this point. For example:
Adds the given point to this point and returns a reference to this point. For example:
Subtracts the given point from this point and returns a reference to this point. For example:
Divides both x and y by the given divisor, and returns a reference to this point. For example:
The divisor must not be zero or NaN.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexpr |
|
inlineconstexprnoexcept |
Returns a point with x and y coordinates exchanged:
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
friend |
Returns true
if p1 is sufficiently different from p2; otherwise returns false
.
Returns a copy of the given point, multiplied by the given finite factor.
Returns a QPointF object that is the sum of the given points, p1 and p2; each component is added separately.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a QPointF object that is formed by changing the sign of each component of the given point.
Equivalent to {QPointF(0,0)
- point}.
Returns a QPointF object that is formed by subtracting p2 from p1; each component is subtracted separately.
Returns the QPointF object formed by dividing each component of the given point by the given divisor.
The divisor must not be zero or NaN.
|
related |
Writes the given point to the given stream and returns a reference to the stream.
Definition at line 794 of file qpoint.cpp.
Returns true
if p1 is approximately equal to p2; otherwise returns false
.
|
related |
Reads a point from the given stream into the given point and returns a reference to the stream.
Definition at line 810 of file qpoint.cpp.
|
friend |