Struct qt_core::QLineF

source ·
#[repr(C)]
pub struct QLineF { /* private fields */ }
Expand description

The QLineF class provides a two-dimensional vector using floating point precision.

C++ class: QLineF.

C++ documentation:

The QLineF class provides a two-dimensional vector using floating point precision.

A QLineF describes a finite length line (or line segment) on a two-dimensional surface. QLineF defines the start and end points of the line using floating point accuracy for coordinates. Use the toLine() function to retrieve an integer based copy of this line.

The positions of the line's start and end points can be retrieved using the p1(), x1(), y1(), p2(), x2(), and y2() functions. The dx() and dy() functions return the horizontal and vertical components of the line, respectively.

The line's length can be retrieved using the length() function, and altered using the setLength() function. Similarly, angle() and setAngle() are respectively used for retrieving and altering the angle of the line. Use the isNull() function to determine whether the QLineF represents a valid line or a null line.

The intersect() function determines the IntersectType for this line and a given line, while the angleTo() function returns the angle between the lines. In addition, the unitVector() function returns a line that has the same starting point as this line, but with a length of only 1, while the normalVector() function returns a line that is perpendicular to this line with the same starting point and length.

Finally, the line can be translated a given offset using the translate() function, and can be traversed using the pointAt() function.

Implementations§

source§

impl QLineF

source

pub unsafe fn angle_0a(&self) -> c_double

Returns the angle (in degrees) between this line and the given line, taking the direction of the lines into account. If the lines do not intersect within their range, it is the intersection point of the extended lines that serves as origin (see QLineF::UnboundedIntersection).

Calls C++ function: double QLineF::angle() const.

Warning: no exact match found in C++ documentation. Below is the C++ documentation for qreal QLineF::angle(const QLineF &line) const:

Returns the angle (in degrees) between this line and the given line, taking the direction of the lines into account. If the lines do not intersect within their range, it is the intersection point of the extended lines that serves as origin (see QLineF::UnboundedIntersection).

When the lines are parallel, this function returns 0 if they have the same direction; otherwise it returns 180.

See also intersect().

source

pub unsafe fn angle_1a(&self, l: impl CastInto<Ref<QLineF>>) -> c_double

Returns the angle (in degrees) between this line and the given line, taking the direction of the lines into account. If the lines do not intersect within their range, it is the intersection point of the extended lines that serves as origin (see QLineF::UnboundedIntersection).

Calls C++ function: double QLineF::angle(const QLineF& l) const.

C++ documentation:

Returns the angle (in degrees) between this line and the given line, taking the direction of the lines into account. If the lines do not intersect within their range, it is the intersection point of the extended lines that serves as origin (see QLineF::UnboundedIntersection).

When the lines are parallel, this function returns 0 if they have the same direction; otherwise it returns 180.

See also intersect().

source

pub unsafe fn angle_to(&self, l: impl CastInto<Ref<QLineF>>) -> c_double

Returns the angle (in degrees) from this line to the given line, taking the direction of the lines into account. If the lines do not intersect within their range, it is the intersection point of the extended lines that serves as origin (see QLineF::UnboundedIntersection).

Calls C++ function: double QLineF::angleTo(const QLineF& l) const.

C++ documentation:

Returns the angle (in degrees) from this line to the given line, taking the direction of the lines into account. If the lines do not intersect within their range, it is the intersection point of the extended lines that serves as origin (see QLineF::UnboundedIntersection).

The returned value represents the number of degrees you need to add to this line to make it have the same angle as the given line, going counter-clockwise.

This function was introduced in Qt 4.4.

See also intersect().

source

pub unsafe fn center(&self) -> CppBox<QPointF>

Returns the center point of this line. This is equivalent to 0.5 * p1() + 0.5 * p2().

Calls C++ function: QPointF QLineF::center() const.

C++ documentation:

Returns the center point of this line. This is equivalent to 0.5 * p1() + 0.5 * p2().

This function was introduced in Qt 5.8.

source

pub unsafe fn copy_from(&self, other: impl CastInto<Ref<QLineF>>) -> Ref<QLineF>

The QLineF class provides a two-dimensional vector using floating point precision.

Calls C++ function: QLineF& QLineF::operator=(const QLineF& other).

C++ documentation:

The QLineF class provides a two-dimensional vector using floating point precision.

A QLineF describes a finite length line (or line segment) on a two-dimensional surface. QLineF defines the start and end points of the line using floating point accuracy for coordinates. Use the toLine() function to retrieve an integer based copy of this line.

The positions of the line's start and end points can be retrieved using the p1(), x1(), y1(), p2(), x2(), and y2() functions. The dx() and dy() functions return the horizontal and vertical components of the line, respectively.

The line's length can be retrieved using the length() function, and altered using the setLength() function. Similarly, angle() and setAngle() are respectively used for retrieving and altering the angle of the line. Use the isNull() function to determine whether the QLineF represents a valid line or a null line.

The intersect() function determines the IntersectType for this line and a given line, while the angleTo() function returns the angle between the lines. In addition, the unitVector() function returns a line that has the same starting point as this line, but with a length of only 1, while the normalVector() function returns a line that is perpendicular to this line with the same starting point and length.

Finally, the line can be translated a given offset using the translate() function, and can be traversed using the pointAt() function.

source

pub unsafe fn dx(&self) -> c_double

Returns the horizontal component of the line's vector.

Calls C++ function: double QLineF::dx() const.

C++ documentation:

Returns the horizontal component of the line’s vector.

See also dy() and pointAt().

source

pub unsafe fn dy(&self) -> c_double

Returns the vertical component of the line's vector.

Calls C++ function: double QLineF::dy() const.

C++ documentation:

Returns the vertical component of the line’s vector.

See also dx() and pointAt().

source

pub unsafe fn from_polar(length: c_double, angle: c_double) -> CppBox<QLineF>

Returns a QLineF with the given length and angle.

Calls C++ function: static QLineF QLineF::fromPolar(double length, double angle).

C++ documentation:

Returns a QLineF with the given length and angle.

The first point of the line will be on the origin.

Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

This function was introduced in Qt 4.4.

source

pub unsafe fn intersect( &self, l: impl CastInto<Ref<QLineF>>, intersection_point: impl CastInto<Ptr<QPointF>> ) -> IntersectType

Returns a value indicating whether or not this line intersects with the given line.

Calls C++ function: QLineF::IntersectType QLineF::intersect(const QLineF& l, QPointF* intersectionPoint) const.

C++ documentation:

Returns a value indicating whether or not this line intersects with the given line.

The actual intersection point is extracted to intersectionPoint (if the pointer is valid). If the lines are parallel, the intersection point is undefined.

source

pub unsafe fn intersects( &self, l: impl CastInto<Ref<QLineF>>, intersection_point: impl CastInto<Ptr<QPointF>> ) -> IntersectType

Available on cpp_lib_version="5.14.0" only.

Returns a value indicating whether or not this line intersects with the given line.

Calls C++ function: QLineF::IntersectType QLineF::intersects(const QLineF& l, QPointF* intersectionPoint) const.

C++ documentation:

Returns a value indicating whether or not this line intersects with the given line.

The actual intersection point is extracted to intersectionPoint (if the pointer is valid). If the lines are parallel, the intersection point is undefined.

This function was introduced in Qt 5.14.

source

pub unsafe fn is_null(&self) -> bool

Returns true if the line is not set up with valid start and end point; otherwise returns false.

Calls C++ function: bool QLineF::isNull() const.

C++ documentation:

Returns true if the line is not set up with valid start and end point; otherwise returns false.

source

pub unsafe fn length(&self) -> c_double

Returns the length of the line.

Calls C++ function: double QLineF::length() const.

C++ documentation:

Returns the length of the line.

See also setLength().

source

pub unsafe fn new_0a() -> CppBox<QLineF>

Constructs a null line.

Calls C++ function: [constructor] void QLineF::QLineF().

C++ documentation:

Constructs a null line.

source

pub unsafe fn new_2a( pt1: impl CastInto<Ref<QPointF>>, pt2: impl CastInto<Ref<QPointF>> ) -> CppBox<QLineF>

Constructs a line object that represents the line between p1 and p2.

Calls C++ function: [constructor] void QLineF::QLineF(const QPointF& pt1, const QPointF& pt2).

C++ documentation:

Constructs a line object that represents the line between p1 and p2.

source

pub unsafe fn new_4a( x1: c_double, y1: c_double, x2: c_double, y2: c_double ) -> CppBox<QLineF>

Constructs a line object that represents the line between (x1, y1) and (x2, y2).

Calls C++ function: [constructor] void QLineF::QLineF(double x1, double y1, double x2, double y2).

C++ documentation:

Constructs a line object that represents the line between (x1, y1) and (x2, y2).

source

pub unsafe fn new_1a(line: impl CastInto<Ref<QLine>>) -> CppBox<QLineF>

Construct a QLineF object from the given integer-based line.

Calls C++ function: [constructor] void QLineF::QLineF(const QLine& line).

C++ documentation:

Construct a QLineF object from the given integer-based line.

See also toLine().

source

pub unsafe fn new_copy(other: impl CastInto<Ref<QLineF>>) -> CppBox<QLineF>

The QLineF class provides a two-dimensional vector using floating point precision.

Calls C++ function: [constructor] void QLineF::QLineF(const QLineF& other).

C++ documentation:

The QLineF class provides a two-dimensional vector using floating point precision.

A QLineF describes a finite length line (or line segment) on a two-dimensional surface. QLineF defines the start and end points of the line using floating point accuracy for coordinates. Use the toLine() function to retrieve an integer based copy of this line.

The positions of the line's start and end points can be retrieved using the p1(), x1(), y1(), p2(), x2(), and y2() functions. The dx() and dy() functions return the horizontal and vertical components of the line, respectively.

The line's length can be retrieved using the length() function, and altered using the setLength() function. Similarly, angle() and setAngle() are respectively used for retrieving and altering the angle of the line. Use the isNull() function to determine whether the QLineF represents a valid line or a null line.

The intersect() function determines the IntersectType for this line and a given line, while the angleTo() function returns the angle between the lines. In addition, the unitVector() function returns a line that has the same starting point as this line, but with a length of only 1, while the normalVector() function returns a line that is perpendicular to this line with the same starting point and length.

Finally, the line can be translated a given offset using the translate() function, and can be traversed using the pointAt() function.

source

pub unsafe fn normal_vector(&self) -> CppBox<QLineF>

Returns a line that is perpendicular to this line with the same starting point and length.

Calls C++ function: QLineF QLineF::normalVector() const.

C++ documentation:

Returns a line that is perpendicular to this line with the same starting point and length.

See also unitVector().

source

pub unsafe fn p1(&self) -> CppBox<QPointF>

Returns the line's start point.

Calls C++ function: QPointF QLineF::p1() const.

C++ documentation:

Returns the line’s start point.

See also setP1(), x1(), y1(), and p2().

source

pub unsafe fn p2(&self) -> CppBox<QPointF>

Returns the line's end point.

Calls C++ function: QPointF QLineF::p2() const.

C++ documentation:

Returns the line’s end point.

See also setP2(), x2(), y2(), and p1().

source

pub unsafe fn point_at(&self, t: c_double) -> CppBox<QPointF>

Returns the point at the parameterized position specified by t. The function returns the line's start point if t = 0, and its end point if t = 1.

Calls C++ function: QPointF QLineF::pointAt(double t) const.

C++ documentation:

Returns the point at the parameterized position specified by t. The function returns the line’s start point if t = 0, and its end point if t = 1.

See also dx() and dy().

source

pub unsafe fn set_angle(&self, angle: c_double)

Sets the angle of the line to the given angle (in degrees). This will change the position of the second point of the line such that the line has the given angle.

Calls C++ function: void QLineF::setAngle(double angle).

C++ documentation:

Sets the angle of the line to the given angle (in degrees). This will change the position of the second point of the line such that the line has the given angle.

Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

This function was introduced in Qt 4.4.

See also angle().

source

pub unsafe fn set_length(&self, len: c_double)

Sets the length of the line to the given length. QLineF will move the end point - p2() - of the line to give the line its new length.

Calls C++ function: void QLineF::setLength(double len).

C++ documentation:

Sets the length of the line to the given length. QLineF will move the end point - p2() - of the line to give the line its new length.

If the line is a null line, the length will remain zero regardless of the length specified.

See also length() and isNull().

source

pub unsafe fn set_line( &self, x1: c_double, y1: c_double, x2: c_double, y2: c_double )

Sets this line to the start in x1, y1 and end in x2, y2.

Calls C++ function: void QLineF::setLine(double x1, double y1, double x2, double y2).

C++ documentation:

Sets this line to the start in x1, y1 and end in x2, y2.

This function was introduced in Qt 4.4.

See also setP1(), setP2(), p1(), and p2().

source

pub unsafe fn set_p1(&self, p1: impl CastInto<Ref<QPointF>>)

Sets the starting point of this line to p1.

Calls C++ function: void QLineF::setP1(const QPointF& p1).

C++ documentation:

Sets the starting point of this line to p1.

This function was introduced in Qt 4.4.

See also setP2() and p1().

source

pub unsafe fn set_p2(&self, p2: impl CastInto<Ref<QPointF>>)

Sets the end point of this line to p2.

Calls C++ function: void QLineF::setP2(const QPointF& p2).

C++ documentation:

Sets the end point of this line to p2.

This function was introduced in Qt 4.4.

See also setP1() and p2().

source

pub unsafe fn set_points( &self, p1: impl CastInto<Ref<QPointF>>, p2: impl CastInto<Ref<QPointF>> )

Sets the start point of this line to p1 and the end point of this line to p2.

Calls C++ function: void QLineF::setPoints(const QPointF& p1, const QPointF& p2).

C++ documentation:

Sets the start point of this line to p1 and the end point of this line to p2.

This function was introduced in Qt 4.4.

See also setP1(), setP2(), p1(), and p2().

source

pub unsafe fn to_line(&self) -> CppBox<QLine>

Returns an integer based copy of this line.

Calls C++ function: QLine QLineF::toLine() const.

C++ documentation:

Returns an integer based copy of this line.

Note that the returned line's start and end points are rounded to the nearest integer.

See also QLineF().

source

pub unsafe fn translate_1a(&self, p: impl CastInto<Ref<QPointF>>)

Translates this line by the given offset.

Calls C++ function: void QLineF::translate(const QPointF& p).

C++ documentation:

Translates this line by the given offset.

source

pub unsafe fn translate_2a(&self, dx: c_double, dy: c_double)

This is an overloaded function.

Calls C++ function: void QLineF::translate(double dx, double dy).

C++ documentation:

This is an overloaded function.

Translates this line the distance specified by dx and dy.

source

pub unsafe fn translated_1a( &self, p: impl CastInto<Ref<QPointF>> ) -> CppBox<QLineF>

Returns this line translated by the given offset.

Calls C++ function: QLineF QLineF::translated(const QPointF& p) const.

C++ documentation:

Returns this line translated by the given offset.

This function was introduced in Qt 4.4.

source

pub unsafe fn translated_2a(&self, dx: c_double, dy: c_double) -> CppBox<QLineF>

This is an overloaded function.

Calls C++ function: QLineF QLineF::translated(double dx, double dy) const.

C++ documentation:

This is an overloaded function.

Returns this line translated the distance specified by dx and dy.

This function was introduced in Qt 4.4.

source

pub unsafe fn unit_vector(&self) -> CppBox<QLineF>

Returns the unit vector for this line, i.e a line starting at the same point as this line with a length of 1.0.

Calls C++ function: QLineF QLineF::unitVector() const.

C++ documentation:

Returns the unit vector for this line, i.e a line starting at the same point as this line with a length of 1.0.

See also normalVector().

source

pub unsafe fn x1(&self) -> c_double

Returns the x-coordinate of the line's start point.

Calls C++ function: double QLineF::x1() const.

C++ documentation:

Returns the x-coordinate of the line’s start point.

See also p1().

source

pub unsafe fn x2(&self) -> c_double

Returns the x-coordinate of the line's end point.

Calls C++ function: double QLineF::x2() const.

C++ documentation:

Returns the x-coordinate of the line’s end point.

See also p2().

source

pub unsafe fn y1(&self) -> c_double

Returns the y-coordinate of the line's start point.

Calls C++ function: double QLineF::y1() const.

C++ documentation:

Returns the y-coordinate of the line’s start point.

See also p1().

source

pub unsafe fn y2(&self) -> c_double

Returns the y-coordinate of the line's end point.

Calls C++ function: double QLineF::y2() const.

C++ documentation:

Returns the y-coordinate of the line’s end point.

See also p2().

Trait Implementations§

source§

impl CppDeletable for QLineF

source§

unsafe fn delete(&self)

The QLineF class provides a two-dimensional vector using floating point precision.

Calls C++ function: [destructor] void QLineF::~QLineF().

C++ documentation:

The QLineF class provides a two-dimensional vector using floating point precision.

A QLineF describes a finite length line (or line segment) on a two-dimensional surface. QLineF defines the start and end points of the line using floating point accuracy for coordinates. Use the toLine() function to retrieve an integer based copy of this line.

The positions of the line's start and end points can be retrieved using the p1(), x1(), y1(), p2(), x2(), and y2() functions. The dx() and dy() functions return the horizontal and vertical components of the line, respectively.

The line's length can be retrieved using the length() function, and altered using the setLength() function. Similarly, angle() and setAngle() are respectively used for retrieving and altering the angle of the line. Use the isNull() function to determine whether the QLineF represents a valid line or a null line.

The intersect() function determines the IntersectType for this line and a given line, while the angleTo() function returns the angle between the lines. In addition, the unitVector() function returns a line that has the same starting point as this line, but with a length of only 1, while the normalVector() function returns a line that is perpendicular to this line with the same starting point and length.

Finally, the line can be translated a given offset using the translate() function, and can be traversed using the pointAt() function.

source§

impl PartialEq<Ref<QLineF>> for QLineF

source§

fn eq(&self, d: &Ref<QLineF>) -> bool

Returns true if the given line is the same as this line.

Calls C++ function: bool QLineF::operator==(const QLineF& d) const.

C++ documentation:

Returns true if the given line is the same as this line.

A line is identical to another line if the start and end points are identical, and the internal order of the points is the same.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.