#[repr(C)]pub struct QPointF { /* private fields */ }
Expand description
The QPointF class defines a point in the plane using floating point precision.
C++ class: 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, 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:
QPointF p;
p.setX(p.x() + 1.0); p += QPointF(1.0, 0.0); p.rx()++;
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.
Implementations§
source§impl QPointF
impl QPointF
sourcepub unsafe fn add_assign(&self, p: impl CastInto<Ref<QPointF>>) -> Ref<QPointF>
pub unsafe fn add_assign(&self, p: impl CastInto<Ref<QPointF>>) -> Ref<QPointF>
Adds the given point to this point and returns a reference to this point. For example:
Calls C++ function: QPointF& QPointF::operator+=(const QPointF& p)
.
Adds the given point to this point and returns a reference to this point. For example:
QPointF p( 3.1, 7.1); QPointF q(-1.0, 4.1); p += q; // p becomes (2.1, 11.2)
See also operator-=().
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QPointF>>
) -> Ref<QPointF>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QPointF>> ) -> Ref<QPointF>
The QPointF class defines a point in the plane using floating point precision.
Calls C++ function: QPointF& QPointF::operator=(const QPointF& other)
.
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, 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:
QPointF p;
p.setX(p.x() + 1.0); p += QPointF(1.0, 0.0); p.rx()++;
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.
sourcepub unsafe fn div_assign(&self, c: c_double) -> Ref<QPointF>
pub unsafe fn div_assign(&self, c: c_double) -> Ref<QPointF>
Divides both x and y by the given divisor, and returns a reference to this point. For example:
Calls C++ function: QPointF& QPointF::operator/=(double c)
.
Divides both x and y by the given divisor, and returns a reference to this point. For example:
QPointF p(-2.75, 10.25); p /= 2.5; // p becomes (-1.1, 4.1)
See also operator*=().
sourcepub unsafe fn dot_product(
p1: impl CastInto<Ref<QPointF>>,
p2: impl CastInto<Ref<QPointF>>
) -> c_double
pub unsafe fn dot_product( p1: impl CastInto<Ref<QPointF>>, p2: impl CastInto<Ref<QPointF>> ) -> c_double
sourcepub unsafe fn is_null(&self) -> bool
pub unsafe fn is_null(&self) -> bool
Returns true
if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returns false
.
Calls C++ function: bool QPointF::isNull() const
.
Returns true
if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returns false
.
sourcepub unsafe fn manhattan_length(&self) -> c_double
pub unsafe fn manhattan_length(&self) -> c_double
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.
Calls C++ function: double QPointF::manhattanLength() const
.
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.
This function was introduced in Qt 4.6.
See also QPoint::manhattanLength().
sourcepub unsafe fn mul_assign(&self, c: c_double) -> Ref<QPointF>
pub unsafe fn mul_assign(&self, c: c_double) -> Ref<QPointF>
Multiplies this point's coordinates by the given factor, and returns a reference to this point. For example:
Calls C++ function: QPointF& QPointF::operator*=(double c)
.
Multiplies this point’s coordinates by the given factor, and returns a reference to this point. For example:
QPointF p(-1.1, 4.1); p *= 2.5; // p becomes (-2.75, 10.25)
See also operator/=().
sourcepub unsafe fn neg(&self) -> CppBox<QPointF>
pub unsafe fn neg(&self) -> CppBox<QPointF>
Calls C++ function: QPointF operator-(const QPointF& p)
.
sourcepub unsafe fn new_0a() -> CppBox<QPointF>
pub unsafe fn new_0a() -> CppBox<QPointF>
Constructs a null point, i.e. with coordinates (0.0, 0.0)
Calls C++ function: [constructor] void QPointF::QPointF()
.
Constructs a null point, i.e. with coordinates (0.0, 0.0)
See also isNull().
sourcepub unsafe fn new_1a(p: impl CastInto<Ref<QPoint>>) -> CppBox<QPointF>
pub unsafe fn new_1a(p: impl CastInto<Ref<QPoint>>) -> CppBox<QPointF>
Constructs a copy of the given point.
Calls C++ function: [constructor] void QPointF::QPointF(const QPoint& p)
.
Constructs a copy of the given point.
See also toPoint().
sourcepub unsafe fn new_2a(xpos: c_double, ypos: c_double) -> CppBox<QPointF>
pub unsafe fn new_2a(xpos: c_double, ypos: c_double) -> CppBox<QPointF>
Constructs a point with the given coordinates (xpos, ypos).
Calls C++ function: [constructor] void QPointF::QPointF(double xpos, double ypos)
.
sourcepub unsafe fn new_copy(other: impl CastInto<Ref<QPointF>>) -> CppBox<QPointF>
pub unsafe fn new_copy(other: impl CastInto<Ref<QPointF>>) -> CppBox<QPointF>
The QPointF class defines a point in the plane using floating point precision.
Calls C++ function: [constructor] void QPointF::QPointF(const QPointF& other)
.
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, 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:
QPointF p;
p.setX(p.x() + 1.0); p += QPointF(1.0, 0.0); p.rx()++;
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.
sourcepub unsafe fn rx(&self) -> *mut c_double
pub unsafe fn rx(&self) -> *mut c_double
Returns a reference to the x coordinate of this point.
Calls C++ function: double& QPointF::rx()
.
sourcepub unsafe fn ry(&self) -> *mut c_double
pub unsafe fn ry(&self) -> *mut c_double
Returns a reference to the y coordinate of this point.
Calls C++ function: double& QPointF::ry()
.
sourcepub unsafe fn set_x(&self, x: c_double)
pub unsafe fn set_x(&self, x: c_double)
Sets the x coordinate of this point to the given x coordinate.
Calls C++ function: void QPointF::setX(double x)
.
sourcepub unsafe fn set_y(&self, y: c_double)
pub unsafe fn set_y(&self, y: c_double)
Sets the y coordinate of this point to the given y coordinate.
Calls C++ function: void QPointF::setY(double y)
.
sourcepub unsafe fn sub_assign(&self, p: impl CastInto<Ref<QPointF>>) -> Ref<QPointF>
pub unsafe fn sub_assign(&self, p: impl CastInto<Ref<QPointF>>) -> Ref<QPointF>
Subtracts the given point from this point and returns a reference to this point. For example:
Calls C++ function: QPointF& QPointF::operator-=(const QPointF& p)
.
Subtracts the given point from this point and returns a reference to this point. For example:
QPointF p( 3.1, 7.1); QPointF q(-1.0, 4.1); p -= q; // p becomes (4.1, 3.0)
See also operator+=().
sourcepub unsafe fn to_point(&self) -> CppBox<QPoint>
pub unsafe fn to_point(&self) -> CppBox<QPoint>
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rounded coordinates.
Calls C++ function: QPoint QPointF::toPoint() const
.
sourcepub unsafe fn transposed(&self) -> CppBox<QPointF>
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn transposed(&self) -> CppBox<QPointF>
cpp_lib_version="5.14.0"
only.Returns a point with x and y coordinates exchanged:
Calls C++ function: QPointF QPointF::transposed() const
.
sourcepub unsafe fn unary_plus(&self) -> CppBox<QPointF>
pub unsafe fn unary_plus(&self) -> CppBox<QPointF>
Calls C++ function: QPointF operator+(const QPointF& p)
.
Trait Implementations§
source§impl CppDeletable for QPointF
impl CppDeletable for QPointF
source§unsafe fn delete(&self)
unsafe fn delete(&self)
The QPointF class defines a point in the plane using floating point precision.
Calls C++ function: [destructor] void QPointF::~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, 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:
QPointF p;
p.setX(p.x() + 1.0); p += QPointF(1.0, 0.0); p.rx()++;
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.
source§impl PartialEq<Ref<QPointF>> for QPointF
impl PartialEq<Ref<QPointF>> for QPointF
source§fn eq(&self, p2: &Ref<QPointF>) -> bool
fn eq(&self, p2: &Ref<QPointF>) -> bool
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
Calls C++ function: bool operator==(const QPointF& p1, const QPointF& p2)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2)
:
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.