Struct QLineF

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

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

Implementations§

Source§

impl QLineF

Source

pub fn angle(&self) -> f64

Returns the angle of the line in degrees.

Source§

impl QLineF

Source

pub fn angle_to(&self, line: &QLineF) -> f64

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).

Source§

impl QLineF

Source

pub fn p1(&self) -> QPointF

Returns the line’s start point.

Source§

impl QLineF

Source

pub fn p2(&self) -> QPointF

Returns the line’s end point.

Source§

impl QLineF

Source

pub fn x1(&self) -> f64

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

Source§

impl QLineF

Source

pub fn x2(&self) -> f64

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

Source§

impl QLineF

Source

pub fn y1(&self) -> f64

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

Source§

impl QLineF

Source

pub fn y2(&self) -> f64

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

Source§

impl QLineF

Source

pub fn center(&self) -> QPointF

Returns the center point of this line. This is equivalent to (p1() + p2()) / 2, except it will never overflow.

Source§

impl QLineF

Source

pub fn dx(&self) -> f64

Returns the horizontal component of the line’s vector.

Source§

impl QLineF

Source

pub fn dy(&self) -> f64

Returns the vertical component of the line’s vector.

Source§

impl QLineF

Source

pub fn is_null(&self) -> bool

Returns true if the line does not have distinct start and end points; otherwise returns false.

Source§

impl QLineF

Source

pub fn length(&self) -> f64

Returns the length of the line.

Source§

impl QLineF

Source

pub fn normal_vector(&self) -> QLineF

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

Source§

impl QLineF

Source

pub fn point_at(&self, t: f64) -> 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.

Source§

impl QLineF

Source

pub fn set_angle(&mut self, angle: f64)

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.

Source§

impl QLineF

Source

pub fn set_length(&mut self, length: f64)

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, unless length() was previously zero, i in which case no scaling is attempted. For lines with very short lengths (represented by denormal floating-point values), results may be imprecise.

Source§

impl QLineF

Source

pub fn set_p1(&mut self, p1: &QPointF)

Sets the starting point of this line to p1.

Source§

impl QLineF

Source

pub fn set_p2(&mut self, p1: &QPointF)

Sets the end point of this line to p2.

Source§

impl QLineF

Source

pub fn set_line(&mut self, x1: f64, y1: f64, x2: f64, y2: f64)

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

Source§

impl QLineF

Source

pub fn set_points(&mut self, p1: &QPointF, p2: &QPointF)

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

Source§

impl QLineF

Source

pub fn to_line(&self) -> QLine

Returns an integer based copy of this line.

Source§

impl QLineF

Source

pub fn translate(&mut self, offset: &QPointF)

Translates this line by the given offset.

Source§

impl QLineF

Source

pub fn translated(&self, offset: &QPointF) -> QLineF

Returns this line translated by the given offset.

Source§

impl QLineF

Source

pub fn unit_vector(&self) -> 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, provided the line is non-null.

Source§

impl QLineF

Source

pub fn new(pt1: QPointF, pt2: QPointF) -> Self

Constructs a line object that represents the line between pt1 and pt2.

Trait Implementations§

Source§

impl Clone for QLineF

Source§

fn clone(&self) -> QLineF

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QLineF

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for QLineF

Source§

fn default() -> Self

Constructs a default qlinef

Source§

impl Display for QLineF

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ExternType for QLineF

Source§

type Id = (Q, L, i, n, e, F)

A type-level representation of the type’s C++ namespace and type name. Read more
Source§

type Kind = Trivial

Source§

impl From<&QLine> for QLineF

Source§

fn from(line: &QLine) -> Self

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

Source§

impl From<QLineF> for QLine

Source§

fn from(value: QLineF) -> Self

Returns an integer-based copy of this line. Note that the returned line’s start and end points are rounded to the nearest integer.

Source§

impl PartialEq for QLineF

Source§

fn eq(&self, other: &QLineF) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl QListElement for QLineF

Source§

type TypeId = (Q, L, i, s, t, __, Q, L, i, n, e, F)

Source§

fn append(list: &mut QList<Self>, value: Self)

Source§

fn append_clone(list: &mut QList<Self>, value: &Self)

Source§

fn clear(list: &mut QList<Self>)

Source§

fn clone(list: &QList<Self>) -> QList<Self>

Source§

fn contains(list: &QList<Self>, value: &Self) -> bool

Source§

fn default() -> QList<Self>

Source§

fn drop(list: &mut QList<Self>)

Source§

unsafe fn get_unchecked(list: &QList<Self>, pos: isize) -> &Self

Safety Read more
Source§

fn index_of(list: &QList<Self>, value: &Self) -> isize

Source§

fn insert(list: &mut QList<Self>, pos: isize, value: Self)

Source§

fn insert_clone(list: &mut QList<Self>, pos: isize, value: &Self)

Source§

fn len(list: &QList<Self>) -> isize

Source§

fn remove(list: &mut QList<Self>, pos: isize)

Source§

fn reserve(list: &mut QList<Self>, size: isize)

Source§

impl QVectorElement for QLineF

Source§

type TypeId = (Q, V, e, c, t, o, r, __, Q, L, i, n, e, F)

Source§

fn append(vector: &mut QVector<Self>, value: Self)

Source§

fn append_clone(vector: &mut QVector<Self>, value: &Self)

Source§

fn clear(vector: &mut QVector<Self>)

Source§

fn clone(vector: &QVector<Self>) -> QVector<Self>

Source§

fn contains(vector: &QVector<Self>, value: &Self) -> bool

Source§

fn default() -> QVector<Self>

Source§

fn drop(vector: &mut QVector<Self>)

Source§

unsafe fn get_unchecked(vector: &QVector<Self>, pos: isize) -> &Self

Safety Read more
Source§

fn index_of(vector: &QVector<Self>, value: &Self) -> isize

Source§

fn insert(vector: &mut QVector<Self>, pos: isize, value: Self)

Source§

fn insert_clone(vector: &mut QVector<Self>, pos: isize, value: &Self)

Source§

fn len(vector: &QVector<Self>) -> isize

Source§

fn remove(vector: &mut QVector<Self>, pos: isize)

Source§

fn reserve(vector: &mut QVector<Self>, size: isize)

Source§

impl StructuralPartialEq for QLineF

Auto Trait Implementations§

§

impl Freeze for QLineF

§

impl RefUnwindSafe for QLineF

§

impl Send for QLineF

§

impl Sync for QLineF

§

impl Unpin for QLineF

§

impl UnwindSafe for QLineF

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.