QPointF

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

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.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new QPointF(nativeOrXOrQPoint?: NativeElement | number | QPoint, y: number): QPointF

Overrides Component.constructor

Parameters:

NameTypeDefault
nativeOrXOrQPoint?NativeElement | number | QPoint-
ynumber0

Returns: QPointF

Properties

native

• native: NativeElement | null

Inherited from Component.native

Methods

isNull

â–¸ isNull(): boolean

Returns true if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returns false.

Returns: boolean


manhattanLength

â–¸ manhattanLength(): number

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.

Returns: number


setX

â–¸ setX(value: number): void

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

Parameters:

NameType
valuenumber

Returns: void


setY

â–¸ setY(value: number): void

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

Parameters:

NameType
valuenumber

Returns: void


toPoint

â–¸ toPoint(): QPoint

Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rounded coordinates.

Returns: QPoint


transposed

â–¸ transposed(): QPointF

Returns a point with x and y coordinates exchanged

Returns: QPointF


x

â–¸ x(): number

Returns the x coordinate of this point

Returns: number


y

â–¸ y(): number

Returns the y coordinate of this point

Returns: number


Static dotProduct

â–¸ dotProduct(p1: QPointF, p2: QPointF): number

Returns the dot product of p1 and p2

Parameters:

NameType
p1QPointF
p2QPointF

Returns: number