[−][src]Struct qt_core::QPointF
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.
Methods
impl QPointF
[src]
pub unsafe fn copy_from(
&mut self,
other: impl CastInto<Ref<QPointF>>
) -> MutRef<QPointF>
[src]
&mut self,
other: impl CastInto<Ref<QPointF>>
) -> MutRef<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.
pub unsafe fn dot_product(
p1: impl CastInto<Ref<QPointF>>,
p2: impl CastInto<Ref<QPointF>>
) -> c_double
[src]
p1: impl CastInto<Ref<QPointF>>,
p2: impl CastInto<Ref<QPointF>>
) -> c_double
QPointF p( 3.1, 7.1); QPointF q(-1.0, 4.1); int lengthSquared = QPointF::dotProduct(p, q); // lengthSquared becomes 26.01
Returns the dot product of p1 and p2.
Calls C++ function: static double QPointF::dotProduct(const QPointF& p1, const QPointF& p2)
.
pub unsafe fn is_null(&self) -> bool
[src]
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
.
pub unsafe fn manhattan_length(&self) -> c_double
[src]
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().
pub unsafe fn neg(&self) -> CppBox<QPointF>
[src]
Calls C++ function: QPointF operator-(const QPointF& p)
.
pub unsafe fn new_0a() -> CppBox<QPointF>
[src]
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().
pub unsafe fn new_1a(p: impl CastInto<Ref<QPoint>>) -> CppBox<QPointF>
[src]
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().
pub unsafe fn new_2a(xpos: c_double, ypos: c_double) -> CppBox<QPointF>
[src]
Constructs a point with the given coordinates (xpos, ypos).
Calls C++ function: [constructor] void QPointF::QPointF(double xpos, double ypos)
.
pub unsafe fn new_copy(other: impl CastInto<Ref<QPointF>>) -> CppBox<QPointF>
[src]
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.
pub unsafe fn rx(&mut self) -> MutRef<c_double>
[src]
Returns a reference to the x coordinate of this point.
Calls C++ function: double& QPointF::rx()
.
pub unsafe fn ry(&mut self) -> MutRef<c_double>
[src]
Returns a reference to the y coordinate of this point.
Calls C++ function: double& QPointF::ry()
.
pub unsafe fn set_x(&mut self, x: c_double)
[src]
Sets the x coordinate of this point to the given x coordinate.
Calls C++ function: void QPointF::setX(double x)
.
pub unsafe fn set_y(&mut self, y: c_double)
[src]
Sets the y coordinate of this point to the given y coordinate.
Calls C++ function: void QPointF::setY(double y)
.
pub unsafe fn to_point(&self) -> CppBox<QPoint>
[src]
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
.
pub unsafe fn transposed(&self) -> CppBox<QPointF>
[src]
Returns a point with x and y coordinates exchanged:
Calls C++ function: QPointF QPointF::transposed() const
.
Returns a point with x and y coordinates exchanged:
QPointF{1.0, 2.0}.transposed() // {2.0, 1.0}
This function was introduced in Qt 5.14.
This item is available if cpp_lib_version="5.14.0"
.
pub unsafe fn unary_plus(&self) -> CppBox<QPointF>
[src]
Calls C++ function: QPointF operator+(const QPointF& p)
.
pub unsafe fn x(&self) -> c_double
[src]
Returns the x coordinate of this point.
Calls C++ function: double QPointF::x() const
.
pub unsafe fn y(&self) -> c_double
[src]
Returns the y coordinate of this point.
Calls C++ function: double QPointF::y() const
.
Trait Implementations
impl<'_> Add<Ref<QPointF>> for &'_ QPointF
[src]
type Output = CppBox<QPointF>
The resulting type after applying the +
operator.
fn add(self, p2: Ref<QPointF>) -> CppBox<QPointF>
[src]
Calls C++ function: QPointF operator+(const QPointF& p1, const QPointF& p2)
.
impl AddAssign<Ref<QPointF>> for QPointF
[src]
fn add_assign(&mut self, p: Ref<QPointF>)
[src]
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-=().
impl CppDeletable for QPointF
[src]
unsafe fn delete(&mut self)
[src]
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.
impl<'_> Div<f64> for &'_ QPointF
[src]
type Output = CppBox<QPointF>
The resulting type after applying the /
operator.
fn div(self, divisor: c_double) -> CppBox<QPointF>
[src]
Calls C++ function: QPointF operator/(const QPointF& p, double divisor)
.
impl DivAssign<f64> for QPointF
[src]
fn div_assign(&mut self, c: c_double)
[src]
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*=().
impl<'_> Mul<f64> for &'_ QPointF
[src]
type Output = CppBox<QPointF>
The resulting type after applying the *
operator.
fn mul(self, c: c_double) -> CppBox<QPointF>
[src]
Calls C++ function: QPointF operator*(const QPointF& p, double c)
.
impl MulAssign<f64> for QPointF
[src]
fn mul_assign(&mut self, c: c_double)
[src]
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/=().
impl PartialEq<Ref<QPointF>> for QPointF
[src]
fn eq(&self, p2: &Ref<QPointF>) -> bool
[src]
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
.
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> Sub<Ref<QPointF>> for &'_ QPointF
[src]
type Output = CppBox<QPointF>
The resulting type after applying the -
operator.
fn sub(self, p2: Ref<QPointF>) -> CppBox<QPointF>
[src]
Calls C++ function: QPointF operator-(const QPointF& p1, const QPointF& p2)
.
impl SubAssign<Ref<QPointF>> for QPointF
[src]
fn sub_assign(&mut self, p: Ref<QPointF>)
[src]
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+=().
Auto Trait Implementations
impl RefUnwindSafe for QPointF
impl Send for QPointF
impl Sync for QPointF
impl Unpin for QPointF
impl UnwindSafe for QPointF
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
unsafe fn static_upcast_mut(ptr: MutPtr<T>) -> MutPtr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,