6.0.0-rc4Source

QPointF Class

The QPointF class defines a point in the plane using floating point precision. More…

Header#include <QPointF>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes

List of all members, including inherited members

Public Functions

QPointF()
QPointF(const QPoint &p)
QPointF(double xpos, double ypos)
boolisNull() const
doublex() const
doubley() const
voidsetX(double x)
voidsetY(double y)
double &rx()
double &ry()
doublemanhattanLength() const
QPointFtransposed() const
QPointtoPoint() const
QPointF &operator+=(const QPointF &p)
QPointF &operator-=(const QPointF &p)
QPointF &operator*=(double f)
QPointF &operator/=(double d)

Static Public Members

doubledotProduct(const QPointF &a, const QPointF &b)

Detailed Description

A point is specified by an x coordinate and a y coordinate, both stored as double. Use QPoint for integer coordinates.

Equality comparison is fuzzy: two coordinates are considered equal if they are equal within the precision of double, as determined by qFuzzyCompare() and qFuzzyIsNull().

See also QPoint and QLineF.

Differences from Qt

Coordinates are always double, which is what qreal is in Nt. There are no platform conversions such as toCGPoint().

Member Function Documentation

[constexpr] QPointF::QPointF()

Constructs a null point, that is, a point with coordinates (0.0, 0.0).

See also isNull().

[constexpr] QPointF::QPointF(const QPoint &p)

Constructs a copy of the given integer point p.

See also toPoint() and QPoint::toPointF().

[constexpr] QPointF::QPointF(double xpos, double ypos)

Constructs a point with coordinates (xpos, ypos).

[static, constexpr] double QPointF::dotProduct(const QPointF &a, const QPointF &b)

Returns the dot product of a and b.

bool QPointF::isNull() const

Returns true if both the x and y coordinates are fuzzily equal to 0; otherwise returns false.

[constexpr] double QPointF::manhattanLength() const

Returns the sum of the absolute values of x() and y(), the distance of the point from the origin measured along the axes.

[constexpr] QPointF & QPointF::operator*=(double f)

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

[constexpr] QPointF & QPointF::operator+=(const QPointF &p)

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

[constexpr] QPointF & QPointF::operator-=(const QPointF &p)

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

[constexpr] QPointF & QPointF::operator/=(double d)

Divides both coordinates of this point by the given divisor d and returns a reference to this point.

[constexpr] double & QPointF::rx()

Returns a reference to the x coordinate of this point, allowing it to be modified directly.

See also x() and setX().

[constexpr] double & QPointF::ry()

Returns a reference to the y coordinate of this point, allowing it to be modified directly.

See also y() and setY().

[constexpr] void QPointF::setX(double x)

Sets the x coordinate of this point to the given x coordinate.

See also x() and setY().

[constexpr] void QPointF::setY(double y)

Sets the y coordinate of this point to the given y coordinate.

See also y() and setX().

QPoint QPointF::toPoint() const

Returns a QPoint with each coordinate rounded to the nearest integer.

See also QPoint::toPointF().

[constexpr] QPointF QPointF::transposed() const

Returns a point with the x and y coordinates exchanged.

See also QPoint::transposed().

[constexpr] double QPointF::x() const

Returns the x coordinate of this point.

See also setX() and rx().

[constexpr] double QPointF::y() const

Returns the y coordinate of this point.

See also setY() and ry().