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

source

pub fn adjust(&mut self, dx1: i32, dy1: i32, dx2: i32, dy2: i32)

Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.

source§

impl QRect

source

pub fn adjusted(&self, dx1: i32, dy1: i32, dx2: i32, dy2: i32) -> QRect

Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of this rectangle.

source§

impl QRect

source

pub fn bottom(&self) -> i32

Returns the y-coordinate of the rectangle’s bottom edge.

Note that for historical reasons this function returns top() + height() - 1; use y() + height() to retrieve the true y-coordinate.

source§

impl QRect

source

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

source

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

source

pub fn center(&self) -> QPoint

Returns the center point of the rectangle.

source§

impl QRect

source

pub fn contains(&self, point: &QPoint, proper: bool) -> bool

Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false. If proper is true, this function only returns true if the given point is inside the rectangle (i.e., not on the edge).

source§

impl QRect

source

pub fn height(&self) -> i32

Returns the height of the rectangle.

source§

impl QRect

source

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

source

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

source

pub fn is_empty(&self) -> bool

Returns true if the rectangle is empty, otherwise returns false.

An empty rectangle has a left() > right() or top() > bottom(). An empty rectangle is not valid (i.e., isEmpty() == !isValid()).

source§

impl QRect

source

pub fn is_null(&self) -> bool

Returns true if the rectangle is a null rectangle, otherwise returns false.

A null rectangle has both the width and the height set to 0 (i.e., right() == left() - 1 and bottom() == top() - 1). A null rectangle is also empty, and hence is not valid.

source§

impl QRect

source

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

source

pub fn left(&self) -> i32

Returns the x-coordinate of the rectangle’s left edge. Equivalent to x().

source§

impl QRect

source

pub fn margins_added(&self, margins: &QMargins) -> QRect

Returns a rectangle grown by the margins.

source§

impl QRect

source

pub fn margins_removed(&self, margins: &QMargins) -> QRect

Removes the margins from the rectangle, shrinking it.

source§

impl QRect

source

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

source

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

source

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

source

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

source

pub fn move_left(&mut self, x: i32)

Moves the rectangle horizontally, leaving the rectangle’s left edge at the given x coordinate. The rectangle’s size is unchanged.

source§

impl QRect

source

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

source

pub fn move_to(&mut self, position: &QPoint)

Moves the rectangle, leaving the top-left corner at the given position.

source§

impl QRect

source

pub fn move_top(&mut self, y: i32)

Moves the rectangle vertically, leaving the rectangle’s top edge at the given y coordinate. The rectangle’s size is unchanged.

source§

impl QRect

source

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

source

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

source

pub fn normalized(&self) -> QRect

Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.

source§

impl QRect

source

pub fn right(&self) -> i32

Returns the x-coordinate of the rectangle’s right edge.

Note that for historical reasons this function returns left() + width() - 1; use x() + width() to retrieve the true x-coordinate.

source§

impl QRect

source

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

source

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

source

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

source

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

Sets the coordinates of the rectangle’s top-left corner to (x1, y1), and the coordinates of its bottom-right corner to (x2, y2).

source§

impl QRect

source

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

source

pub fn set_left(&mut self, x: i32)

Sets the left edge of the rectangle to the given x coordinate. May change the width, but will never change the right edge of the rectangle.

source§

impl QRect

source

pub fn set_rect(&mut self, x: i32, y: i32, width: i32, height: i32)

Sets the coordinates of the rectangle’s top-left corner to (x, y), and its size to the given width and height.

source§

impl QRect

source

pub fn set_right(&mut self, x: i32)

Sets the right edge of the rectangle to the given x coordinate. May change the width, but will never change the left edge of the rectangle.

source§

impl QRect

source

pub fn set_size(&mut self, size: &QSize)

Sets the size of the rectangle to the given size. The top-left corner is not moved.

source§

impl QRect

source

pub fn set_top(&mut self, y: i32)

Sets the top edge of the rectangle to the given y coordinate. May change the height, but will never change the bottom edge of the rectangle.

source§

impl QRect

source

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

source

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

source

pub fn set_width(&mut self, w: i32)

Sets the width of the rectangle to the given width. The right edge is changed, but not the left one.

source§

impl QRect

source

pub fn set_x(&mut self, x: i32)

Sets the left edge of the rectangle to the given x coordinate. May change the width, but will never change the right edge of the rectangle.

source§

impl QRect

source

pub fn set_y(&mut self, y: i32)

Sets the top edge of the rectangle to the given y coordinate. May change the height, but will never change the bottom edge of the rectangle.

source§

impl QRect

source

pub fn size(&self) -> QSize

Returns the size of the rectangle.

source§

impl QRect

source

pub fn top(&self) -> i32

Returns the y-coordinate of the rectangle’s top edge. Equivalent to y().

source§

impl QRect

source

pub fn top_left(&self) -> QPoint

Returns the position of the rectangle’s top-left corner.

source§

impl QRect

source

pub fn top_right(&self) -> QPoint

Returns the position of the rectangle’s top-right corner.

Note that for historical reasons this function returns QPoint(left() + width() -1, top()).

source§

impl QRect

source

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

Moves the rectangle offset.x() along the x axis and offset.y() along the y axis, relative to the current position.

source§

impl QRect

source

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

source

pub fn transposed(&self) -> QRect

Returns a copy of the rectangle that has its width and height exchanged.

source§

impl QRect

source

pub fn united(&self, rectangle: &QRect) -> QRect

Returns the bounding rectangle of this rectangle and the given rectangle.

source§

impl QRect

source

pub fn width(&self) -> i32

Returns the width of the rectangle.

source§

impl QRect

source

pub fn x(&self) -> i32

Returns the x-coordinate of the rectangle’s left edge.

source§

impl QRect

source

pub fn y(&self) -> i32

Returns the y-coordinate of the rectangle’s top edge.

source§

impl QRect

source

pub fn new(x: i32, y: i32, width: i32, height: i32) -> Self

Constructs a rectangle with (x, y) as its top-left corner and the given width and height.

Trait Implementations§

source§

impl Add<QMargins> for QRect

§

type Output = QRect

The resulting type after applying the + operator.
source§

fn add(self, other: QMargins) -> Self

Performs the + operation. Read more
source§

impl Clone for QRect

source§

fn clone(&self) -> QRect

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 QRect

source§

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

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

impl Default for QRect

source§

fn default() -> Self

Constructs a null rectangle.

source§

impl Display for QRect

source§

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

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

impl ExternType for QRect

§

type Id = (Q, R, e, c, t)

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

type Kind = Trivial

source§

impl From<&QRect> for QRectF

source§

fn from(rectangle: &QRect) -> Self

Constructs a QRectF rectangle from the given QRect rectangle.

source§

impl From<&QRectF> for QRect

source§

fn from(value: &QRectF) -> Self

Returns a QRect based on the values of this rectangle. Note that the coordinates in the returned rectangle are rounded to the nearest integer.

source§

impl PartialEq for QRect

source§

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

This method tests for self and other values to be equal, and is used by ==.
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.
source§

impl QListElement for QRect

§

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

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 QVariantValue for QRect

source§

impl QVectorElement for QRect

§

type TypeId = (Q, V, e, c, t, o, r, __, Q, R, e, c, t)

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 Sub<QMargins> for QRect

§

type Output = QRect

The resulting type after applying the - operator.
source§

fn sub(self, other: QMargins) -> Self

Performs the - operation. Read more
source§

impl Eq for QRect

source§

impl StructuralPartialEq for QRect

Auto Trait Implementations§

§

impl Freeze for QRect

§

impl RefUnwindSafe for QRect

§

impl Send for QRect

§

impl Sync for QRect

§

impl Unpin for QRect

§

impl UnwindSafe for QRect

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

§

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§

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

§

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.