Struct cxx_qt_lib::QRect
source · #[repr(C)]pub struct QRect { /* private fields */ }
Expand description
The QRect struct defines a rectangle in the plane using integer precision.
Implementations§
source§impl QRect
impl QRect
sourcepub fn bottom_left(&self) -> QPoint
pub fn bottom_left(&self) -> QPoint
Returns the position of the rectangle’s bottom-left corner.
Note that for historical reasons this function returns QPoint(left(), top() + height() - 1).
source§impl QRect
impl QRect
sourcepub fn bottom_right(&self) -> QPoint
pub fn bottom_right(&self) -> QPoint
Returns the position of the rectangle’s bottom-right corner.
Note that for historical reasons this function returns QPoint(left() + width() -1, top() + height() - 1).
source§impl QRect
impl QRect
sourcepub fn intersected(&self, rectangle: &QRect) -> QRect
pub fn intersected(&self, rectangle: &QRect) -> QRect
Returns the intersection of this rectangle and the given rectangle. Note that r.intersected(s) is equivalent to r & s.
source§impl QRect
impl QRect
sourcepub fn intersects(&self, rectangle: &QRect) -> bool
pub fn intersects(&self, rectangle: &QRect) -> bool
Returns true if this rectangle intersects with the given rectangle (i.e., there is at least one pixel that is within both rectangles), otherwise returns false.
source§impl QRect
impl QRect
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if the rectangle is valid, otherwise returns false.
A valid rectangle has a left() <= right() and top() <= bottom(). Note that non-trivial operations like intersections are not defined for invalid rectangles. A valid rectangle is not empty (i.e., isValid() == !isEmpty()).
source§impl QRect
impl QRect
sourcepub fn margins_added(&self, margins: &QMargins) -> QRect
pub fn margins_added(&self, margins: &QMargins) -> QRect
Returns a rectangle grown by the margins.
source§impl QRect
impl QRect
sourcepub fn margins_removed(&self, margins: &QMargins) -> QRect
pub fn margins_removed(&self, margins: &QMargins) -> QRect
Removes the margins from the rectangle, shrinking it.
source§impl QRect
impl QRect
sourcepub fn move_bottom(&mut self, y: i32)
pub fn move_bottom(&mut self, y: i32)
Moves the rectangle vertically, leaving the rectangle’s bottom edge at the given y coordinate. The rectangle’s size is unchanged.
source§impl QRect
impl QRect
sourcepub fn move_bottom_left(&mut self, position: &QPoint)
pub fn move_bottom_left(&mut self, position: &QPoint)
Moves the rectangle, leaving the bottom-left corner at the given position. The rectangle’s size is unchanged.
source§impl QRect
impl QRect
sourcepub fn move_bottom_right(&mut self, position: &QPoint)
pub fn move_bottom_right(&mut self, position: &QPoint)
Moves the rectangle, leaving the bottom-right corner at the given position. The rectangle’s size is unchanged.
source§impl QRect
impl QRect
sourcepub fn move_center(&mut self, position: &QPoint)
pub fn move_center(&mut self, position: &QPoint)
Moves the rectangle, leaving the center point at the given position. The rectangle’s size is unchanged.
source§impl QRect
impl QRect
sourcepub fn move_right(&mut self, x: i32)
pub fn move_right(&mut self, x: i32)
Moves the rectangle horizontally, leaving the rectangle’s right edge at the given x coordinate. The rectangle’s size is unchanged.
source§impl QRect
impl QRect
sourcepub fn move_top_left(&mut self, position: &QPoint)
pub fn move_top_left(&mut self, position: &QPoint)
Moves the rectangle, leaving the top-left corner at the given position. The rectangle’s size is unchanged.
source§impl QRect
impl QRect
sourcepub fn move_top_right(&mut self, position: &QPoint)
pub fn move_top_right(&mut self, position: &QPoint)
Moves the rectangle, leaving the top-right corner at the given position. The rectangle’s size is unchanged.
source§impl QRect
impl QRect
sourcepub fn normalized(&self) -> QRect
pub fn normalized(&self) -> QRect
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.
source§impl QRect
impl QRect
sourcepub fn set_bottom(&mut self, y: i32)
pub fn set_bottom(&mut self, y: i32)
Sets the bottom edge of the rectangle to the given y coordinate. May change the height, but will never change the top edge of the rectangle.
source§impl QRect
impl QRect
sourcepub fn set_bottom_left(&mut self, position: &QPoint)
pub fn set_bottom_left(&mut self, position: &QPoint)
Set the bottom-left corner of the rectangle to the given position. May change the size, but will never change the top-right corner of the rectangle.
source§impl QRect
impl QRect
sourcepub fn set_bottom_right(&mut self, position: &QPoint)
pub fn set_bottom_right(&mut self, position: &QPoint)
Set the bottom-right corner of the rectangle to the given position. May change the size, but will never change the top-left corner of the rectangle.
source§impl QRect
impl QRect
sourcepub fn set_height(&mut self, h: i32)
pub fn set_height(&mut self, h: i32)
Sets the height of the rectangle to the given height. The bottom edge is changed, but not the top one.
source§impl QRect
impl QRect
sourcepub fn set_top_left(&mut self, position: &QPoint)
pub fn set_top_left(&mut self, position: &QPoint)
Set the top-left corner of the rectangle to the given position. May change the size, but will never change the bottom-right corner of the rectangle.
source§impl QRect
impl QRect
sourcepub fn set_top_right(&mut self, position: &QPoint)
pub fn set_top_right(&mut self, position: &QPoint)
Set the top-right corner of the rectangle to the given position. May change the size, but will never change the bottom-left corner of the rectangle.
source§impl QRect
impl QRect
sourcepub fn translated(&self, offset: &QPoint) -> QRect
pub fn translated(&self, offset: &QPoint) -> QRect
Returns a copy of the rectangle that is translated offset.x() along the x axis and offset.y() along the y axis, relative to the current position.
source§impl QRect
impl QRect
sourcepub fn transposed(&self) -> QRect
pub fn transposed(&self) -> QRect
Returns a copy of the rectangle that has its width and height exchanged.