Struct QLine

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

The QLine class provides a two-dimensional vector using integer precision

Implementations§

Source§

impl QLine

Source

pub fn p1(&self) -> QPoint

Returns the line’s start point.

Source§

impl QLine

Source

pub fn p2(&self) -> QPoint

Returns the line’s end point.

Source§

impl QLine

Source

pub fn x1(&self) -> i32

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

Source§

impl QLine

Source

pub fn x2(&self) -> i32

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

Source§

impl QLine

Source

pub fn y1(&self) -> i32

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

Source§

impl QLine

Source

pub fn y2(&self) -> i32

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

Source§

impl QLine

Source

pub fn center(&self) -> QPoint

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

Source§

impl QLine

Source

pub fn dx(&self) -> i32

Returns the horizontal component of the line’s vector.

Source§

impl QLine

Source

pub fn dy(&self) -> i32

Returns the vertical component of the line’s vector.

Source§

impl QLine

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 QLine

Source

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

Sets the starting point of this line to p1.

Source§

impl QLine

Source

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

Sets the end point of this line to p2.

Source§

impl QLine

Source

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

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

Source§

impl QLine

Source

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

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

Source§

impl QLine

Source

pub fn to_linef(&self) -> QLineF

Returns this line as a line with floating point accuracy. since Qt 6.4.

Source§

impl QLine

Source

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

Translates this line by the given offset.

Source§

impl QLine

Source

pub fn translated(&self, offset: &QPoint) -> QLine

Returns this line translated by the given offset.

Source§

impl QLine

Source

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

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

Trait Implementations§

Source§

impl Clone for QLine

Source§

fn clone(&self) -> QLine

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 QLine

Source§

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

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

impl Default for QLine

Source§

fn default() -> Self

Constructs a null line.

Source§

impl Display for QLine

Source§

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

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

impl ExternType for QLine

Source§

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

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 QLine

Source§

fn eq(&self, other: &QLine) -> 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 QLine

Source§

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

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 QLine

Source§

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

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 Eq for QLine

Source§

impl StructuralPartialEq for QLine

Auto Trait Implementations§

§

impl Freeze for QLine

§

impl RefUnwindSafe for QLine

§

impl Send for QLine

§

impl Sync for QLine

§

impl Unpin for QLine

§

impl UnwindSafe for QLine

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.