PySide6.QtCore.QPointF¶
- class QPointF¶
The
QPointF
class defines a point in the plane using floating point precision. More…Synopsis¶
Methods¶
def
__init__()
def
__reduce__()
def
__repr__()
def
isNull()
def
__ne__()
def
__mul__()
def
__imul__()
def
__add__()
def
__iadd__()
def
__sub__()
def
__isub__()
def
__div__()
def
operator/=()
def
__eq__()
def
setX()
def
setY()
def
toPoint()
def
toTuple()
def
transposed()
def
x()
def
y()
Static functions¶
def
dotProduct()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
A point is specified by a x coordinate and an y coordinate which can be accessed using the
x()
andy()
functions. The coordinates of the point are specified using finite floating point numbers for accuracy. TheisNull()
function returnstrue
if both x and y are set to 0.0. The coordinates can be set (or altered) using thesetX()
andsetY()
functions, or alternatively therx()
andry()
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() += 1
A
QPointF
object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). AQPointF
object can also be divided or multiplied by anint
or aqreal
.In addition, the
QPointF
class provides a constructor converting aQPoint
object into aQPointF
object, and a correspondingtoPoint()
function which returns aQPoint
copy of this point. Finally,QPointF
objects can be streamed as well as compared.- __init__()¶
Constructs a null point, i.e. with coordinates (0.0, 0.0)
See also
- __init__(p)
- Parameters:
p –
QPoint
Constructs a copy of the given
point
.See also
- __init__(xpos, ypos)
- Parameters:
xpos – float
ypos – float
Constructs a point with the given coordinates (
xpos
,ypos
).- __reduce__()¶
- Return type:
str
- __repr__()¶
- Return type:
str
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
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
andp2
.- isNull()¶
- Return type:
bool
Returns
true
if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returnsfalse
.- manhattanLength()¶
- Return type:
float
Returns the sum of the absolute values of
x()
andy()
, traditionally known as the “Manhattan length” of the vector from the origin to the point.See also
- __ne__(rhs)
- Parameters:
rhs –
QPointF
- Return type:
bool
Returns
true
iflhs
is sufficiently different fromrhs
; otherwise returnsfalse
.Warning
This function does not check for strict inequality; instead, it uses a fuzzy comparison to compare the points’ coordinates.
See also
qFuzzyCompare
- __mul__(matrix)¶
- Parameters:
matrix –
QMatrix4x4
- Return type:
Note
This function is deprecated.
- __mul__(matrix)
- Parameters:
matrix –
QMatrix4x4
- Return type:
- __mul__(m)
- Parameters:
m –
QTransform
- Return type:
- __mul__(c)
- Parameters:
c – float
- Return type:
This is an overloaded function.
Returns a copy of the given
point
, multiplied by the given finitefactor
.- __mul__(c)
- Parameters:
c – float
- Return type:
Returns a copy of the given
point
, multiplied by the given finitefactor
.See also
operator*=()
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
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/=()
Returns
point
unmodified.Returns a
QPointF
object that is the sum of the given points,p1
andp2
; each component is added separately.See also
operator+=()
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
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-=()
This is an overloaded function.
Returns a
QPointF
object that is formed by changing the sign of each component of the givenpoint
.Equivalent to
QPointF(0,0) - point
.Returns a
QPointF
object that is formed by subtractingp2
fromp1
; each component is subtracted separately.See also
operator-=()
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
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+=()
Returns the
QPointF
object formed by dividing each component of the givenpoint
by the givendivisor
.The
divisor
must not be zero or NaN.See also
operator/=()
- operator/=(c)
- Parameters:
c – float
- Return type:
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
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*=()
- __eq__(rhs)
- Parameters:
rhs –
QPointF
- Return type:
bool
Returns
true
iflhs
is approximately equal torhs
; otherwise returnsfalse
.Warning
This function does not check for strict equality; instead, it uses a fuzzy comparison to compare the points’ coordinates.
See also
qFuzzyCompare
- setX(x)¶
- Parameters:
x – float
Sets the x coordinate of this point to the given finite
x
coordinate.- setY(y)¶
- Parameters:
y – float
Sets the y coordinate of this point to the given finite
y
coordinate.Rounds the coordinates of this point to the nearest integer, and returns a
QPoint
object with the rounded coordinates.See also
QPointF()
toPointF()
- toTuple()¶
- Return type:
object
Returns a point with x and y coordinates exchanged:
- x()¶
- Return type:
float
Returns the x coordinate of this point.
See also
setX()
rx()
- y()¶
- Return type:
float
Returns the y coordinate of this point.
See also
setY()
ry()