[][src]Struct qt_core::QRect

#[repr(C)]
pub struct QRect { /* fields omitted */ }

The QRect class defines a rectangle in the plane using integer precision.

C++ class: QRect.

C++ documentation:

The QRect class defines a rectangle in the plane using integer precision.

A rectangle is normally expressed as an upper-left corner and a size. The size (width and height) of a QRect is always equivalent to the mathematical rectangle that forms the basis for its rendering.

A QRect can be constructed with a set of left, top, width and height integers, or from a QPoint and a QSize. The following code creates two identical rectangles.

QRect r1(100, 200, 11, 16); QRect r2(QPoint(100, 200), QSize(11, 16));

There is a third constructor that creates a QRect using the top-left and bottom-right coordinates, but we recommend that you avoid using it. The rationale is that for historical reasons the values returned by the bottom() and right() functions deviate from the true bottom-right corner of the rectangle.

The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRect also provide functions to move the rectangle relative to the various coordinates. In addition there is a moveTo() function that moves the rectangle, leaving its top left corner at the given coordinates. Alternatively, the translate() function moves the rectangle the given offset relative to the current position, and the translated() function returns a translated copy of this rectangle.

The size() function returns the rectange's dimensions as a QSize. The dimensions can also be retrieved separately using the width() and height() functions. To manipulate the dimensions use the setSize(), setWidth() or setHeight() functions. Alternatively, the size can be changed by applying either of the functions setting the rectangle coordinates, for example, setBottom() or setRight().

The contains() function tells whether a given point is inside the rectangle or not, and the intersects() function returns true if this rectangle intersects with a given rectangle. The QRect class also provides the intersected() function which returns the intersection rectangle, and the united() function which returns the rectangle that encloses the given rectangle and this:

The isEmpty() function returns true if left() > right() or top() > bottom(). Note that an empty rectangle is not valid: The isValid() function returns true if left() <= right() and top() <= bottom(). A null rectangle (isNull() == true) on the other hand, has both width and height set to 0.

Note that due to the way QRect and QRectF are defined, an empty QRect is defined in essentially the same way as QRectF.

Finally, QRect objects can be streamed as well as compared.

Methods

impl QRect[src]

pub unsafe fn adjust(&mut self, x1: c_int, y1: c_int, x2: c_int, y2: c_int)[src]

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

Calls C++ function: void QRect::adjust(int x1, int y1, int x2, int y2).

C++ documentation:

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

See also adjusted() and setRect().

pub unsafe fn adjusted(
    &self,
    x1: c_int,
    y1: c_int,
    x2: c_int,
    y2: c_int
) -> CppBox<QRect>
[src]

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

Calls C++ function: QRect QRect::adjusted(int x1, int y1, int x2, int y2) const.

C++ documentation:

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

See also adjust().

pub unsafe fn bottom(&self) -> c_int[src]

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

Calls C++ function: int QRect::bottom() const.

C++ documentation:

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.

See also setBottom(), bottomLeft(), and bottomRight().

pub unsafe fn bottom_left(&self) -> CppBox<QPoint>[src]

Returns the position of the rectangle's bottom-left corner. Note that for historical reasons this function returns QPoint(left(), top() + height() - 1).

Calls C++ function: QPoint QRect::bottomLeft() const.

C++ documentation:

Returns the position of the rectangle's bottom-left corner. Note that for historical reasons this function returns QPoint(left(), top() + height() - 1).

See also setBottomLeft(), bottom(), and left().

pub unsafe fn bottom_right(&self) -> CppBox<QPoint>[src]

Returns the position of the rectangle's bottom-right corner.

Calls C++ function: QPoint QRect::bottomRight() const.

C++ documentation:

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

See also setBottomRight(), bottom(), and right().

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

Returns the center point of the rectangle.

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

C++ documentation:

Returns the center point of the rectangle.

See also moveCenter().

pub unsafe fn contains_q_rect_bool(
    &self,
    r: impl CastInto<Ref<QRect>>,
    proper: bool
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QRect::contains(const QRect& r, bool proper = …) const.

C++ documentation:

This is an overloaded function.

Returns true if the given rectangle is inside this rectangle. otherwise returns false. If proper is true, this function only returns true if the rectangle is entirely inside this rectangle (not on the edge).

pub unsafe fn contains_q_point_bool(
    &self,
    p: impl CastInto<Ref<QPoint>>,
    proper: bool
) -> bool
[src]

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

Calls C++ function: bool QRect::contains(const QPoint& p, bool proper = …) const.

C++ documentation:

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

See also intersects().

pub unsafe fn contains_2_int(&self, x: c_int, y: c_int) -> bool[src]

This is an overloaded function.

Calls C++ function: bool QRect::contains(int x, int y) const.

C++ documentation:

This is an overloaded function.

Returns true if the point (x, y) is inside this rectangle, otherwise returns false.

pub unsafe fn contains_2_int_bool(
    &self,
    x: c_int,
    y: c_int,
    proper: bool
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QRect::contains(int x, int y, bool proper) const.

C++ documentation:

This is an overloaded function.

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

pub unsafe fn contains_q_rect(&self, r: impl CastInto<Ref<QRect>>) -> bool[src]

This is an overloaded function.

Calls C++ function: bool QRect::contains(const QRect& r) const.

C++ documentation:

This is an overloaded function.

Returns true if the given rectangle is inside this rectangle. otherwise returns false. If proper is true, this function only returns true if the rectangle is entirely inside this rectangle (not on the edge).

pub unsafe fn contains_q_point(&self, p: impl CastInto<Ref<QPoint>>) -> bool[src]

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

Calls C++ function: bool QRect::contains(const QPoint& p) const.

C++ documentation:

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

See also intersects().

pub unsafe fn copy_from(
    &mut self,
    other: impl CastInto<Ref<QRect>>
) -> MutRef<QRect>
[src]

The QRect class defines a rectangle in the plane using integer precision.

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

C++ documentation:

The QRect class defines a rectangle in the plane using integer precision.

A rectangle is normally expressed as an upper-left corner and a size. The size (width and height) of a QRect is always equivalent to the mathematical rectangle that forms the basis for its rendering.

A QRect can be constructed with a set of left, top, width and height integers, or from a QPoint and a QSize. The following code creates two identical rectangles.

QRect r1(100, 200, 11, 16); QRect r2(QPoint(100, 200), QSize(11, 16));

There is a third constructor that creates a QRect using the top-left and bottom-right coordinates, but we recommend that you avoid using it. The rationale is that for historical reasons the values returned by the bottom() and right() functions deviate from the true bottom-right corner of the rectangle.

The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRect also provide functions to move the rectangle relative to the various coordinates. In addition there is a moveTo() function that moves the rectangle, leaving its top left corner at the given coordinates. Alternatively, the translate() function moves the rectangle the given offset relative to the current position, and the translated() function returns a translated copy of this rectangle.

The size() function returns the rectange's dimensions as a QSize. The dimensions can also be retrieved separately using the width() and height() functions. To manipulate the dimensions use the setSize(), setWidth() or setHeight() functions. Alternatively, the size can be changed by applying either of the functions setting the rectangle coordinates, for example, setBottom() or setRight().

The contains() function tells whether a given point is inside the rectangle or not, and the intersects() function returns true if this rectangle intersects with a given rectangle. The QRect class also provides the intersected() function which returns the intersection rectangle, and the united() function which returns the rectangle that encloses the given rectangle and this:

The isEmpty() function returns true if left() > right() or top() > bottom(). Note that an empty rectangle is not valid: The isValid() function returns true if left() <= right() and top() <= bottom(). A null rectangle (isNull() == true) on the other hand, has both width and height set to 0.

Note that due to the way QRect and QRectF are defined, an empty QRect is defined in essentially the same way as QRectF.

Finally, QRect objects can be streamed as well as compared.

pub unsafe fn get_coords(
    &self,
    x1: impl CastInto<MutPtr<c_int>>,
    y1: impl CastInto<MutPtr<c_int>>,
    x2: impl CastInto<MutPtr<c_int>>,
    y2: impl CastInto<MutPtr<c_int>>
)
[src]

Extracts the position of the rectangle's top-left corner to *x1 and *y1, and the position of the bottom-right corner to *x2 and *y2.

Calls C++ function: void QRect::getCoords(int* x1, int* y1, int* x2, int* y2) const.

C++ documentation:

Extracts the position of the rectangle's top-left corner to *x1 and *y1, and the position of the bottom-right corner to *x2 and *y2.

See also setCoords() and getRect().

pub unsafe fn get_rect(
    &self,
    x: impl CastInto<MutPtr<c_int>>,
    y: impl CastInto<MutPtr<c_int>>,
    w: impl CastInto<MutPtr<c_int>>,
    h: impl CastInto<MutPtr<c_int>>
)
[src]

Extracts the position of the rectangle's top-left corner to *x and *y, and its dimensions to *width and *height.

Calls C++ function: void QRect::getRect(int* x, int* y, int* w, int* h) const.

C++ documentation:

Extracts the position of the rectangle's top-left corner to *x and *y, and its dimensions to *width and *height.

See also setRect() and getCoords().

pub unsafe fn height(&self) -> c_int[src]

Returns the height of the rectangle.

Calls C++ function: int QRect::height() const.

C++ documentation:

Returns the height of the rectangle.

See also setHeight(), width(), and size().

pub unsafe fn intersected(
    &self,
    other: impl CastInto<Ref<QRect>>
) -> CppBox<QRect>
[src]

Returns the intersection of this rectangle and the given rectangle. Note that r.intersected(s) is equivalent to r & s.

Calls C++ function: QRect QRect::intersected(const QRect& other) const.

C++ documentation:

Returns the intersection of this rectangle and the given rectangle. Note that r.intersected(s) is equivalent to r & s.

This function was introduced in Qt 4.2.

See also intersects(), united(), and operator&=().

pub unsafe fn intersects(&self, r: impl CastInto<Ref<QRect>>) -> bool[src]

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.

Calls C++ function: bool QRect::intersects(const QRect& r) const.

C++ documentation:

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.

The intersection rectangle can be retrieved using the intersected() function.

See also contains().

pub unsafe fn is_empty(&self) -> bool[src]

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

Calls C++ function: bool QRect::isEmpty() const.

C++ documentation:

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()).

Use the normalized() function to retrieve a rectangle where the corners are swapped.

See also isNull(), isValid(), and normalized().

pub unsafe fn is_null(&self) -> bool[src]

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

Calls C++ function: bool QRect::isNull() const.

C++ documentation:

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.

See also isEmpty() and isValid().

pub unsafe fn is_valid(&self) -> bool[src]

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

Calls C++ function: bool QRect::isValid() const.

C++ documentation:

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()).

See also isNull(), isEmpty(), and normalized().

pub unsafe fn left(&self) -> c_int[src]

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

Calls C++ function: int QRect::left() const.

C++ documentation:

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

See also setLeft(), topLeft(), and bottomLeft().

pub unsafe fn margins_added(
    &self,
    margins: impl CastInto<Ref<QMargins>>
) -> CppBox<QRect>
[src]

Returns a rectangle grown by the margins.

Calls C++ function: QRect QRect::marginsAdded(const QMargins& margins) const.

C++ documentation:

Returns a rectangle grown by the margins.

This function was introduced in Qt 5.1.

See also operator+=(), marginsRemoved(), and operator-=().

pub unsafe fn margins_removed(
    &self,
    margins: impl CastInto<Ref<QMargins>>
) -> CppBox<QRect>
[src]

Removes the margins from the rectangle, shrinking it.

Calls C++ function: QRect QRect::marginsRemoved(const QMargins& margins) const.

C++ documentation:

Removes the margins from the rectangle, shrinking it.

This function was introduced in Qt 5.1.

See also marginsAdded(), operator+=(), and operator-=().

pub unsafe fn move_bottom(&mut self, pos: c_int)[src]

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

Calls C++ function: void QRect::moveBottom(int pos).

C++ documentation:

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

See also bottom(), setBottom(), and moveTop().

pub unsafe fn move_bottom_left(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

Moves the rectangle, leaving the bottom-left corner at the given position. The rectangle's size is unchanged.

Calls C++ function: void QRect::moveBottomLeft(const QPoint& p).

C++ documentation:

Moves the rectangle, leaving the bottom-left corner at the given position. The rectangle's size is unchanged.

See also setBottomLeft(), moveBottom(), and moveLeft().

pub unsafe fn move_bottom_right(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

Moves the rectangle, leaving the bottom-right corner at the given position. The rectangle's size is unchanged.

Calls C++ function: void QRect::moveBottomRight(const QPoint& p).

C++ documentation:

Moves the rectangle, leaving the bottom-right corner at the given position. The rectangle's size is unchanged.

See also setBottomRight(), moveRight(), and moveBottom().

pub unsafe fn move_center(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

Moves the rectangle, leaving the center point at the given position. The rectangle's size is unchanged.

Calls C++ function: void QRect::moveCenter(const QPoint& p).

C++ documentation:

Moves the rectangle, leaving the center point at the given position. The rectangle's size is unchanged.

See also center().

pub unsafe fn move_left(&mut self, pos: c_int)[src]

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

Calls C++ function: void QRect::moveLeft(int pos).

C++ documentation:

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

See also left(), setLeft(), and moveRight().

pub unsafe fn move_right(&mut self, pos: c_int)[src]

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

Calls C++ function: void QRect::moveRight(int pos).

C++ documentation:

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

See also right(), setRight(), and moveLeft().

pub unsafe fn move_to_2a(&mut self, x: c_int, t: c_int)[src]

Moves the rectangle, leaving the top-left corner at the given position (x, y). The rectangle's size is unchanged.

Calls C++ function: void QRect::moveTo(int x, int t).

C++ documentation:

Moves the rectangle, leaving the top-left corner at the given position (x, y). The rectangle's size is unchanged.

See also translate() and moveTopLeft().

pub unsafe fn move_to_1a(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

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

Calls C++ function: void QRect::moveTo(const QPoint& p).

C++ documentation:

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

pub unsafe fn move_top(&mut self, pos: c_int)[src]

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

Calls C++ function: void QRect::moveTop(int pos).

C++ documentation:

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

See also top(), setTop(), and moveBottom().

pub unsafe fn move_top_left(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

Moves the rectangle, leaving the top-left corner at the given position. The rectangle's size is unchanged.

Calls C++ function: void QRect::moveTopLeft(const QPoint& p).

C++ documentation:

Moves the rectangle, leaving the top-left corner at the given position. The rectangle's size is unchanged.

See also setTopLeft(), moveTop(), and moveLeft().

pub unsafe fn move_top_right(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

Moves the rectangle, leaving the top-right corner at the given position. The rectangle's size is unchanged.

Calls C++ function: void QRect::moveTopRight(const QPoint& p).

C++ documentation:

Moves the rectangle, leaving the top-right corner at the given position. The rectangle's size is unchanged.

See also setTopRight(), moveTop(), and moveRight().

pub unsafe fn new() -> CppBox<QRect>[src]

Constructs a null rectangle.

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

C++ documentation:

Constructs a null rectangle.

See also isNull().

pub unsafe fn from_2_q_point(
    topleft: impl CastInto<Ref<QPoint>>,
    bottomright: impl CastInto<Ref<QPoint>>
) -> CppBox<QRect>
[src]

Constructs a rectangle with the given topLeft and bottomRight corners.

Calls C++ function: [constructor] void QRect::QRect(const QPoint& topleft, const QPoint& bottomright).

C++ documentation:

Constructs a rectangle with the given topLeft and bottomRight corners.

See also setTopLeft() and setBottomRight().

pub unsafe fn from_q_point_q_size(
    topleft: impl CastInto<Ref<QPoint>>,
    size: impl CastInto<Ref<QSize>>
) -> CppBox<QRect>
[src]

Constructs a rectangle with the given topLeft corner and the given size.

Calls C++ function: [constructor] void QRect::QRect(const QPoint& topleft, const QSize& size).

C++ documentation:

Constructs a rectangle with the given topLeft corner and the given size.

See also setTopLeft() and setSize().

pub unsafe fn from_4_int(
    left: c_int,
    top: c_int,
    width: c_int,
    height: c_int
) -> CppBox<QRect>
[src]

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

Calls C++ function: [constructor] void QRect::QRect(int left, int top, int width, int height).

C++ documentation:

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

See also setRect().

pub unsafe fn new_copy(other: impl CastInto<Ref<QRect>>) -> CppBox<QRect>[src]

The QRect class defines a rectangle in the plane using integer precision.

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

C++ documentation:

The QRect class defines a rectangle in the plane using integer precision.

A rectangle is normally expressed as an upper-left corner and a size. The size (width and height) of a QRect is always equivalent to the mathematical rectangle that forms the basis for its rendering.

A QRect can be constructed with a set of left, top, width and height integers, or from a QPoint and a QSize. The following code creates two identical rectangles.

QRect r1(100, 200, 11, 16); QRect r2(QPoint(100, 200), QSize(11, 16));

There is a third constructor that creates a QRect using the top-left and bottom-right coordinates, but we recommend that you avoid using it. The rationale is that for historical reasons the values returned by the bottom() and right() functions deviate from the true bottom-right corner of the rectangle.

The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRect also provide functions to move the rectangle relative to the various coordinates. In addition there is a moveTo() function that moves the rectangle, leaving its top left corner at the given coordinates. Alternatively, the translate() function moves the rectangle the given offset relative to the current position, and the translated() function returns a translated copy of this rectangle.

The size() function returns the rectange's dimensions as a QSize. The dimensions can also be retrieved separately using the width() and height() functions. To manipulate the dimensions use the setSize(), setWidth() or setHeight() functions. Alternatively, the size can be changed by applying either of the functions setting the rectangle coordinates, for example, setBottom() or setRight().

The contains() function tells whether a given point is inside the rectangle or not, and the intersects() function returns true if this rectangle intersects with a given rectangle. The QRect class also provides the intersected() function which returns the intersection rectangle, and the united() function which returns the rectangle that encloses the given rectangle and this:

The isEmpty() function returns true if left() > right() or top() > bottom(). Note that an empty rectangle is not valid: The isValid() function returns true if left() <= right() and top() <= bottom(). A null rectangle (isNull() == true) on the other hand, has both width and height set to 0.

Note that due to the way QRect and QRectF are defined, an empty QRect is defined in essentially the same way as QRectF.

Finally, QRect objects can be streamed as well as compared.

pub unsafe fn normalized(&self) -> CppBox<QRect>[src]

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

Calls C++ function: QRect QRect::normalized() const.

C++ documentation:

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

If width() < 0 the function swaps the left and right corners, and it swaps the top and bottom corners if height() < 0.

See also isValid() and isEmpty().

pub unsafe fn right(&self) -> c_int[src]

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

Calls C++ function: int QRect::right() const.

C++ documentation:

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.

See also setRight(), topRight(), and bottomRight().

pub unsafe fn set_bottom(&mut self, pos: c_int)[src]

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.

Calls C++ function: void QRect::setBottom(int pos).

C++ documentation:

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.

See also bottom() and moveBottom().

pub unsafe fn set_bottom_left(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

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.

Calls C++ function: void QRect::setBottomLeft(const QPoint& p).

C++ documentation:

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.

See also bottomLeft() and moveBottomLeft().

pub unsafe fn set_bottom_right(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

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.

Calls C++ function: void QRect::setBottomRight(const QPoint& p).

C++ documentation:

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.

See also bottomRight() and moveBottomRight().

pub unsafe fn set_coords(&mut self, x1: c_int, y1: c_int, x2: c_int, y2: c_int)[src]

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

Calls C++ function: void QRect::setCoords(int x1, int y1, int x2, int y2).

C++ documentation:

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

See also getCoords() and setRect().

pub unsafe fn set_height(&mut self, h: c_int)[src]

Sets the height of the rectangle to the given height. The bottom edge is changed, but not the top one.

Calls C++ function: void QRect::setHeight(int h).

C++ documentation:

Sets the height of the rectangle to the given height. The bottom edge is changed, but not the top one.

See also height() and setSize().

pub unsafe fn set_left(&mut self, pos: c_int)[src]

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.

Calls C++ function: void QRect::setLeft(int pos).

C++ documentation:

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.

Equivalent to setX().

See also left() and moveLeft().

pub unsafe fn set_rect(&mut self, x: c_int, y: c_int, w: c_int, h: c_int)[src]

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

Calls C++ function: void QRect::setRect(int x, int y, int w, int h).

C++ documentation:

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

See also getRect() and setCoords().

pub unsafe fn set_right(&mut self, pos: c_int)[src]

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.

Calls C++ function: void QRect::setRight(int pos).

C++ documentation:

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.

See also right() and moveRight().

pub unsafe fn set_size(&mut self, s: impl CastInto<Ref<QSize>>)[src]

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

Calls C++ function: void QRect::setSize(const QSize& s).

C++ documentation:

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

See also size(), setWidth(), and setHeight().

pub unsafe fn set_top(&mut self, pos: c_int)[src]

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.

Calls C++ function: void QRect::setTop(int pos).

C++ documentation:

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.

Equivalent to setY().

See also top() and moveTop().

pub unsafe fn set_top_left(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

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.

Calls C++ function: void QRect::setTopLeft(const QPoint& p).

C++ documentation:

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.

See also topLeft() and moveTopLeft().

pub unsafe fn set_top_right(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

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.

Calls C++ function: void QRect::setTopRight(const QPoint& p).

C++ documentation:

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.

See also topRight() and moveTopRight().

pub unsafe fn set_width(&mut self, w: c_int)[src]

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

Calls C++ function: void QRect::setWidth(int w).

C++ documentation:

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

See also width() and setSize().

pub unsafe fn set_x(&mut self, x: c_int)[src]

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.

Calls C++ function: void QRect::setX(int x).

C++ documentation:

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.

Equivalent to setLeft().

See also x(), setY(), and setTopLeft().

pub unsafe fn set_y(&mut self, y: c_int)[src]

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.

Calls C++ function: void QRect::setY(int y).

C++ documentation:

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.

Equivalent to setTop().

See also y(), setX(), and setTopLeft().

pub unsafe fn size(&self) -> CppBox<QSize>[src]

Returns the size of the rectangle.

Calls C++ function: QSize QRect::size() const.

C++ documentation:

Returns the size of the rectangle.

See also setSize(), width(), and height().

pub unsafe fn top(&self) -> c_int[src]

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

Calls C++ function: int QRect::top() const.

C++ documentation:

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

See also setTop(), topLeft(), and topRight().

pub unsafe fn top_left(&self) -> CppBox<QPoint>[src]

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

Calls C++ function: QPoint QRect::topLeft() const.

C++ documentation:

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

See also setTopLeft(), top(), and left().

pub unsafe fn top_right(&self) -> CppBox<QPoint>[src]

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

Calls C++ function: QPoint QRect::topRight() const.

C++ documentation:

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

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

See also setTopRight(), top(), and right().

pub unsafe fn translate_2a(&mut self, dx: c_int, dy: c_int)[src]

Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position. Positive values move the rectangle to the right and down.

Calls C++ function: void QRect::translate(int dx, int dy).

C++ documentation:

Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position. Positive values move the rectangle to the right and down.

See also moveTopLeft(), moveTo(), and translated().

pub unsafe fn translate_1a(&mut self, p: impl CastInto<Ref<QPoint>>)[src]

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

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

pub unsafe fn translated_2a(&self, dx: c_int, dy: c_int) -> CppBox<QRect>[src]

Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis, relative to the current position. Positive values move the rectangle to the right and down.

Calls C++ function: QRect QRect::translated(int dx, int dy) const.

C++ documentation:

Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis, relative to the current position. Positive values move the rectangle to the right and down.

See also translate().

pub unsafe fn translated_1a(
    &self,
    p: impl CastInto<Ref<QPoint>>
) -> CppBox<QRect>
[src]

This is an overloaded function.

Calls C++ function: QRect QRect::translated(const QPoint& p) const.

C++ documentation:

This is an overloaded function.

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.

pub unsafe fn transposed(&self) -> CppBox<QRect>[src]

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

Calls C++ function: QRect QRect::transposed() const.

C++ documentation:

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


  QRect r = {15, 51, 42, 24};
  r = r.transposed(); // r == {15, 51, 24, 42}

This function was introduced in Qt 5.7.

See also QSize::transposed().

pub unsafe fn united(&self, other: impl CastInto<Ref<QRect>>) -> CppBox<QRect>[src]

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

Calls C++ function: QRect QRect::united(const QRect& other) const.

C++ documentation:

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

This function was introduced in Qt 4.2.

See also intersected().

pub unsafe fn width(&self) -> c_int[src]

Returns the width of the rectangle.

Calls C++ function: int QRect::width() const.

C++ documentation:

Returns the width of the rectangle.

See also setWidth(), height(), and size().

pub unsafe fn x(&self) -> c_int[src]

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

Calls C++ function: int QRect::x() const.

C++ documentation:

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

See also setX(), y(), and topLeft().

pub unsafe fn y(&self) -> c_int[src]

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

Calls C++ function: int QRect::y() const.

C++ documentation:

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

See also setY(), x(), and topLeft().

Trait Implementations

impl<'_> Add<Ref<QMargins>> for &'_ QRect[src]

type Output = CppBox<QRect>

The resulting type after applying the + operator.

fn add(self, margins: Ref<QMargins>) -> CppBox<QRect>[src]

Calls C++ function: QRect operator+(const QRect& rectangle, const QMargins& margins).

impl AddAssign<Ref<QMargins>> for QRect[src]

fn add_assign(&mut self, margins: Ref<QMargins>)[src]

Adds the margins to the rectangle, growing it.

Calls C++ function: QRect& QRect::operator+=(const QMargins& margins).

C++ documentation:

Adds the margins to the rectangle, growing it.

This function was introduced in Qt 5.1.

See also marginsAdded(), marginsRemoved(), and operator-=().

impl<'_> BitAnd<Ref<QRect>> for &'_ QRect[src]

type Output = CppBox<QRect>

The resulting type after applying the & operator.

fn bitand(self, r: Ref<QRect>) -> CppBox<QRect>[src]

Returns the intersection of this rectangle and the given rectangle. Returns an empty rectangle if there is no intersection.

Calls C++ function: QRect QRect::operator&(const QRect& r) const.

C++ documentation:

Returns the intersection of this rectangle and the given rectangle. Returns an empty rectangle if there is no intersection.

See also operator&=() and intersected().

impl BitAndAssign<Ref<QRect>> for QRect[src]

fn bitand_assign(&mut self, r: Ref<QRect>)[src]

Intersects this rectangle with the given rectangle.

Calls C++ function: QRect& QRect::operator&=(const QRect& r).

C++ documentation:

Intersects this rectangle with the given rectangle.

See also intersected() and operator&().

impl<'_> BitOr<Ref<QRect>> for &'_ QRect[src]

type Output = CppBox<QRect>

The resulting type after applying the | operator.

fn bitor(self, r: Ref<QRect>) -> CppBox<QRect>[src]

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

Calls C++ function: QRect QRect::operator|(const QRect& r) const.

C++ documentation:

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

See also operator|=() and united().

impl BitOrAssign<Ref<QRect>> for QRect[src]

fn bitor_assign(&mut self, r: Ref<QRect>)[src]

Unites this rectangle with the given rectangle.

Calls C++ function: QRect& QRect::operator|=(const QRect& r).

C++ documentation:

Unites this rectangle with the given rectangle.

See also united() and operator|().

impl CppDeletable for QRect[src]

unsafe fn delete(&mut self)[src]

The QRect class defines a rectangle in the plane using integer precision.

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

C++ documentation:

The QRect class defines a rectangle in the plane using integer precision.

A rectangle is normally expressed as an upper-left corner and a size. The size (width and height) of a QRect is always equivalent to the mathematical rectangle that forms the basis for its rendering.

A QRect can be constructed with a set of left, top, width and height integers, or from a QPoint and a QSize. The following code creates two identical rectangles.

QRect r1(100, 200, 11, 16); QRect r2(QPoint(100, 200), QSize(11, 16));

There is a third constructor that creates a QRect using the top-left and bottom-right coordinates, but we recommend that you avoid using it. The rationale is that for historical reasons the values returned by the bottom() and right() functions deviate from the true bottom-right corner of the rectangle.

The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRect also provide functions to move the rectangle relative to the various coordinates. In addition there is a moveTo() function that moves the rectangle, leaving its top left corner at the given coordinates. Alternatively, the translate() function moves the rectangle the given offset relative to the current position, and the translated() function returns a translated copy of this rectangle.

The size() function returns the rectange's dimensions as a QSize. The dimensions can also be retrieved separately using the width() and height() functions. To manipulate the dimensions use the setSize(), setWidth() or setHeight() functions. Alternatively, the size can be changed by applying either of the functions setting the rectangle coordinates, for example, setBottom() or setRight().

The contains() function tells whether a given point is inside the rectangle or not, and the intersects() function returns true if this rectangle intersects with a given rectangle. The QRect class also provides the intersected() function which returns the intersection rectangle, and the united() function which returns the rectangle that encloses the given rectangle and this:

The isEmpty() function returns true if left() > right() or top() > bottom(). Note that an empty rectangle is not valid: The isValid() function returns true if left() <= right() and top() <= bottom(). A null rectangle (isNull() == true) on the other hand, has both width and height set to 0.

Note that due to the way QRect and QRectF are defined, an empty QRect is defined in essentially the same way as QRectF.

Finally, QRect objects can be streamed as well as compared.

impl PartialEq<Ref<QRect>> for QRect[src]

fn eq(&self, arg2: &Ref<QRect>) -> bool[src]

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

Calls C++ function: bool operator==(const QRect& arg1, const QRect& arg2).

Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2):

Returns true if c1 and c2 are the same Unicode character; otherwise returns false.

impl Size for QRect[src]

unsafe fn size(&self) -> usize[src]

Returns the size of the rectangle.

Calls C++ function: QSize QRect::size() const.

C++ documentation:

Returns the size of the rectangle.

See also setSize(), width(), and height().

impl<'_> Sub<Ref<QMargins>> for &'_ QRect[src]

type Output = CppBox<QRect>

The resulting type after applying the - operator.

fn sub(self, rhs: Ref<QMargins>) -> CppBox<QRect>[src]

Calls C++ function: QRect operator-(const QRect& lhs, const QMargins& rhs).

impl SubAssign<Ref<QMargins>> for QRect[src]

fn sub_assign(&mut self, margins: Ref<QMargins>)[src]

Returns a rectangle shrunk by the margins.

Calls C++ function: QRect& QRect::operator-=(const QMargins& margins).

C++ documentation:

Returns a rectangle shrunk by the margins.

This function was introduced in Qt 5.1.

See also marginsRemoved(), operator+=(), and marginsAdded().

Auto Trait Implementations

impl RefUnwindSafe for QRect

impl Send for QRect

impl Sync for QRect

impl Unpin for QRect

impl UnwindSafe for QRect

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.