QPointF#
The QPointF
class defines a point in the plane using floating point precision. More…
Synopsis#
Functions#
def
__add__
()def
__add__
(p2)def
__div__
(divisor)def
__eq__
(p2)def
__iadd__
(p)def
__idiv__
(c)def
__imul__
(c)def
__isub__
(p)def
__mul__
(c)def
__mul__
(c)def
__mul__
(m)def
__mul__
(matrix)def
__mul__
(matrix)def
__ne__
(p2)def
__reduce__
()def
__repr__
()def
__sub__
()def
__sub__
(p2)def
isNull
()def
manhattanLength
()def
setX
(x)def
setY
(y)def
toPoint
()def
toTuple
()def
transposed
()def
x
()def
y
()
Static functions#
def
dotProduct
(p1, p2)
Detailed Description#
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:
p = QPointF() p.setX(p.x() + 1.0) p += QPointF(1.0, 0.0) p.rx() = p.rx() + 1
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.
See also
QPoint
QPolygonF
- class PySide6.QtCore.QPointF#
PySide6.QtCore.QPointF(p)
PySide6.QtCore.QPointF(QPointF)
PySide6.QtCore.QPointF(xpos, ypos)
- Parameters
ypos – float
xpos – float
QPointF –
PySide6.QtCore.QPointF
Constructs a null point, i.e. with coordinates (0.0, 0.0)
See also
Constructs a copy of the given point
.
See also
Constructs a point with the given coordinates (xpos
, ypos
).
- PySide6.QtCore.QPointF.__reduce__()#
- Return type
object
- PySide6.QtCore.QPointF.__repr__()#
- Return type
object
- static PySide6.QtCore.QPointF.dotProduct(p1, p2)#
- Parameters
- Return type
float
p = QPointF( 3.1, 7.1) q = QPointF(-1.0, 4.1) dotProduct = QPointF.dotProduct(p, q) # dotProduct becomes 26.01()
Returns the dot product of p1
and p2
.
- PySide6.QtCore.QPointF.isNull()#
- Return type
bool
Returns true
if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returns false
.
- PySide6.QtCore.QPointF.manhattanLength()#
- Return type
float
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.
See also
- PySide6.QtCore.QPointF.__ne__(p2)#
- Parameters
- Return type
bool
Returns true
if p1
is sufficiently different from p2
; otherwise returns false
.
Warning
This function does not check for strict inequality; instead, it uses a fuzzy comparison to compare the points’ coordinates.
See also
qFuzzyCompare
- PySide6.QtCore.QPointF.__mul__(matrix)#
- Parameters
matrix –
PySide6.QtGui.QMatrix4x4
- Return type
Note
This function is deprecated.
- PySide6.QtCore.QPointF.__mul__(matrix)
- Parameters
matrix –
PySide6.QtGui.QMatrix4x4
- Return type
- PySide6.QtCore.QPointF.__mul__(m)
- Parameters
- Return type
- PySide6.QtCore.QPointF.__mul__(c)
- Parameters
c – float
- Return type
This is an overloaded function.
Returns a copy of the given point
, multiplied by the given finite factor
.
- PySide6.QtCore.QPointF.__mul__(c)
- Parameters
c – float
- Return type
Returns a copy of the given point
, multiplied by the given finite factor
.
See also
operator*=()
- PySide6.QtCore.QPointF.__imul__(c)#
- Parameters
c – float
- Return type
Multiplies this point’s coordinates by the given finite factor
, and returns a reference to this point. For example:
p = QPointF(-1.1, 4.1) = 2.5 # p becomes (-2.75, 10.25)See also
operator/=()
- PySide6.QtCore.QPointF.__add__(p2)#
- Parameters
- Return type
Returns a QPointF
object that is the sum of the given points, p1
and p2
; each component is added separately.
See also
operator+=()
- PySide6.QtCore.QPointF.__add__()
- Return type
Returns point
unmodified.
- PySide6.QtCore.QPointF.__iadd__(p)#
- Parameters
- Return type
Adds the given point
to this point and returns a reference to this point. For example:
p = QPointF( 3.1, 7.1) q = QPointF(-1.0, 4.1) p += q # p becomes (2.1, 11.2)See also
operator-=()
- PySide6.QtCore.QPointF.__sub__()#
- Return type
This is an overloaded function.
Returns a QPointF
object that is formed by changing the sign of each component of the given point
.
Equivalent to QPointF(0,0) - point
.
- PySide6.QtCore.QPointF.__sub__(p2)
- Parameters
- Return type
Returns a QPointF
object that is formed by subtracting p2
from p1
; each component is subtracted separately.
See also
operator-=()
- PySide6.QtCore.QPointF.__isub__(p)#
- Parameters
- Return type
Subtracts the given point
from this point and returns a reference to this point. For example:
p = QPointF( 3.1, 7.1) q = QPointF(-1.0, 4.1) p -= q # p becomes (4.1, 3.0)See also
operator+=()
- PySide6.QtCore.QPointF.__div__(divisor)#
- Parameters
divisor – float
- Return type
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.
See also
operator/=()
- PySide6.QtCore.QPointF.__idiv__(c)#
- Parameters
c – float
- Return type
Divides both x and y by the given divisor
, and returns a reference to this point. For example:
p = QPointF(-2.75, 10.25) p /= 2.5 # p becomes (-1.1, 4.1)
The divisor
must not be zero or NaN.
See also
operator*=()
- PySide6.QtCore.QPointF.__eq__(p2)#
- Parameters
- Return type
bool
Returns true
if p1
is approximately equal to p2
; otherwise returns false
.
Warning
This function does not check for strict equality; instead, it uses a fuzzy comparison to compare the points’ coordinates.
See also
qFuzzyCompare
- PySide6.QtCore.QPointF.setX(x)#
- Parameters
x – float
Sets the x coordinate of this point to the given finite x
coordinate.
- PySide6.QtCore.QPointF.setY(y)#
- Parameters
y – float
Sets the y coordinate of this point to the given finite y
coordinate.
- PySide6.QtCore.QPointF.toPoint()#
- Return type
Rounds the coordinates of this point to the nearest integer, and returns a QPoint
object with the rounded coordinates.
See also
QPointF()
toPointF()
- PySide6.QtCore.QPointF.toTuple()#
- Return type
object
- PySide6.QtCore.QPointF.transposed()#
- Return type
Returns a point with x and y coordinates exchanged:
- PySide6.QtCore.QPointF.x()#
- Return type
float
Returns the x coordinate of this point.
See also
setX()
rx()
- PySide6.QtCore.QPointF.y()#
- Return type
float
Returns the y coordinate of this point.
See also
setY()
ry()