pub struct Line<'a> { /* private fields */ }
Expand description
Notice these docs are heavy WIP and not very relevent yet
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.
Licence
The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Implementations
sourceimpl<'a> Line<'a>
impl<'a> Line<'a>
pub fn new() -> Line<'a>
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true
if the line is not set up with valid start and end point;
otherwise returns false.
sourcepub fn dx(&self) -> i32
pub fn dx(&self) -> i32
Returns the horizontal component of the line’s vector.
See also: [dy()
]
sourcepub fn center(&self) -> Point<'_>
pub fn center(&self) -> Point<'_>
Returns the center point of this line. This is equivalent to (p1() + p2()) / 2, except it will never overflow.
sourcepub fn set_p1<P: PointTrait<'a>>(&self, p1: &P) -> &Self
pub fn set_p1<P: PointTrait<'a>>(&self, p1: &P) -> &Self
Sets the starting point of this line to p1.
See also: [set_p2()
]
[p1()
]
sourcepub fn set_p2<P: PointTrait<'a>>(&self, p2: &P) -> &Self
pub fn set_p2<P: PointTrait<'a>>(&self, p2: &P) -> &Self
Sets the end point of this line to p2.
See also: [set_p1()
]
[p2()
]
sourcepub fn set_points<P: PointTrait<'a>>(&self, p1: &P, p2: &P) -> &Self
pub fn set_points<P: PointTrait<'a>>(&self, p1: &P, p2: &P) -> &Self
Sets the start point of this line to p1 and the end point of this line to p2.
See also: [set_p1()
]
[set_p2()
]
[p1()
]
[p2()
]