Struct qt_core::QLine

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

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

C++ class: QLine.

C++ documentation:

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

A QLine describes a finite length line (or a line segment) on a two-dimensional surface. The start and end points of the line are specified using integer point accuracy for coordinates. Use the QLineF constructor to retrieve a floating point copy.

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. Use isNull() to determine whether the QLine represents a valid line or a null line.

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

Implementations§

source§

impl QLine

source

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

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

Calls C++ function: QPoint QLine::center() const.

C++ documentation:

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

This function was introduced in Qt 5.8.

source

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

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

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

C++ documentation:

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

A QLine describes a finite length line (or a line segment) on a two-dimensional surface. The start and end points of the line are specified using integer point accuracy for coordinates. Use the QLineF constructor to retrieve a floating point copy.

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. Use isNull() to determine whether the QLine represents a valid line or a null line.

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

source

pub unsafe fn dx(&self) -> c_int

Returns the horizontal component of the line's vector.

Calls C++ function: int QLine::dx() const.

C++ documentation:

Returns the horizontal component of the line’s vector.

See also dy().

source

pub unsafe fn dy(&self) -> c_int

Returns the vertical component of the line's vector.

Calls C++ function: int QLine::dy() const.

C++ documentation:

Returns the vertical component of the line’s vector.

See also dx().

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 QLine::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 new_0a() -> CppBox<QLine>

Constructs a null line.

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

C++ documentation:

Constructs a null line.

source

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

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

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

C++ documentation:

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

source

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

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

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

C++ documentation:

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

source

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

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

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

C++ documentation:

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

A QLine describes a finite length line (or a line segment) on a two-dimensional surface. The start and end points of the line are specified using integer point accuracy for coordinates. Use the QLineF constructor to retrieve a floating point copy.

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. Use isNull() to determine whether the QLine represents a valid line or a null line.

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

source

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

Returns the line's start point.

Calls C++ function: QPoint QLine::p1() const.

C++ documentation:

Returns the line’s start point.

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

source

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

Returns the line's end point.

Calls C++ function: QPoint QLine::p2() const.

C++ documentation:

Returns the line’s end point.

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

source

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

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

Calls C++ function: void QLine::setLine(int x1, int y1, int x2, int 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<QPoint>>)

Sets the starting point of this line to p1.

Calls C++ function: void QLine::setP1(const QPoint& 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<QPoint>>)

Sets the end point of this line to p2.

Calls C++ function: void QLine::setP2(const QPoint& 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<QPoint>>, p2: impl CastInto<Ref<QPoint>> )

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

Calls C++ function: void QLine::setPoints(const QPoint& p1, const QPoint& 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 translate_1a(&self, p: impl CastInto<Ref<QPoint>>)

Translates this line by the given offset.

Calls C++ function: void QLine::translate(const QPoint& p).

C++ documentation:

Translates this line by the given offset.

source

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

This is an overloaded function.

Calls C++ function: void QLine::translate(int dx, int 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<QPoint>> ) -> CppBox<QLine>

Returns this line translated by the given offset.

Calls C++ function: QLine QLine::translated(const QPoint& 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_int, dy: c_int) -> CppBox<QLine>

This is an overloaded function.

Calls C++ function: QLine QLine::translated(int dx, int 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 x1(&self) -> c_int

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

Calls C++ function: int QLine::x1() const.

C++ documentation:

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

See also p1().

source

pub unsafe fn x2(&self) -> c_int

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

Calls C++ function: int QLine::x2() const.

C++ documentation:

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

See also p2().

source

pub unsafe fn y1(&self) -> c_int

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

Calls C++ function: int QLine::y1() const.

C++ documentation:

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

See also p1().

source

pub unsafe fn y2(&self) -> c_int

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

Calls C++ function: int QLine::y2() const.

C++ documentation:

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

See also p2().

Trait Implementations§

source§

impl CppDeletable for QLine

source§

unsafe fn delete(&self)

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

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

C++ documentation:

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

A QLine describes a finite length line (or a line segment) on a two-dimensional surface. The start and end points of the line are specified using integer point accuracy for coordinates. Use the QLineF constructor to retrieve a floating point copy.

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. Use isNull() to determine whether the QLine represents a valid line or a null line.

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

source§

impl PartialEq<Ref<QLine>> for QLine

source§

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

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

Calls C++ function: bool QLine::operator==(const QLine& 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§

§

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