[][src]Struct qt_core::QRectF

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

The QRectF class defines a rectangle in the plane using floating point precision.

C++ class: QRectF.

C++ documentation:

The QRectF class defines a rectangle in the plane using floating point precision.

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

A QRectF can be constructed with a set of left, top, width and height coordinates, or from a QPointF and a QSizeF. The following code creates two identical rectangles.

QRectF r1(100.0, 200.1, 11.2, 16.3); QRectF r2(QPointF(100.0, 200.1), QSizeF(11.2, 16.3));

There is also a third constructor creating a QRectF from a QRect, and a corresponding toRect() function that returns a QRect object based on the values of this rectangle (note that the coordinates in the returned rectangle are rounded to the nearest integer).

The QRectF class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRectF 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 QSizeF. 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 (otherwise false). The QRectF 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 the rectangle's width or height is less than, or equal to, 0. Note that an empty rectangle is not valid: The isValid() function returns true if both width and height is larger than 0. 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 QRectF is defined in essentially the same way as QRect.

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

Methods

impl QRectF[src]

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

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

Calls C++ function: void QRectF::adjust(double x1, double y1, double x2, double 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_double,
    y1: c_double,
    x2: c_double,
    y2: c_double
) -> CppBox<QRectF>
[src]

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

Calls C++ function: QRectF QRectF::adjusted(double x1, double y1, double x2, double 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_double[src]

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

Calls C++ function: double QRectF::bottom() const.

C++ documentation:

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

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

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

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

Calls C++ function: QPointF QRectF::bottomLeft() const.

C++ documentation:

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

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

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

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

Calls C++ function: QPointF QRectF::bottomRight() const.

C++ documentation:

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

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

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

Returns the center point of the rectangle.

Calls C++ function: QPointF QRectF::center() const.

C++ documentation:

Returns the center point of the rectangle.

See also moveCenter().

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

This is an overloaded function.

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

C++ documentation:

This is an overloaded function.

Returns true if the given rectangle is inside this rectangle; otherwise returns false.

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

Returns true if the given point is inside or on the edge of the rectangle; otherwise returns false.

Calls C++ function: bool QRectF::contains(const QPointF& p) const.

C++ documentation:

Returns true if the given point is inside or on the edge of the rectangle; otherwise returns false.

See also intersects().

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

This is an overloaded function.

Calls C++ function: bool QRectF::contains(double x, double y) 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.

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

The QRectF class defines a rectangle in the plane using floating point precision.

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

C++ documentation:

The QRectF class defines a rectangle in the plane using floating point precision.

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

A QRectF can be constructed with a set of left, top, width and height coordinates, or from a QPointF and a QSizeF. The following code creates two identical rectangles.

QRectF r1(100.0, 200.1, 11.2, 16.3); QRectF r2(QPointF(100.0, 200.1), QSizeF(11.2, 16.3));

There is also a third constructor creating a QRectF from a QRect, and a corresponding toRect() function that returns a QRect object based on the values of this rectangle (note that the coordinates in the returned rectangle are rounded to the nearest integer).

The QRectF class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRectF 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 QSizeF. 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 (otherwise false). The QRectF 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 the rectangle's width or height is less than, or equal to, 0. Note that an empty rectangle is not valid: The isValid() function returns true if both width and height is larger than 0. 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 QRectF is defined in essentially the same way as QRect.

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

pub unsafe fn get_coords(
    &self,
    x1: impl CastInto<MutPtr<c_double>>,
    y1: impl CastInto<MutPtr<c_double>>,
    x2: impl CastInto<MutPtr<c_double>>,
    y2: impl CastInto<MutPtr<c_double>>
)
[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 QRectF::getCoords(double* x1, double* y1, double* x2, double* 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_double>>,
    y: impl CastInto<MutPtr<c_double>>,
    w: impl CastInto<MutPtr<c_double>>,
    h: impl CastInto<MutPtr<c_double>>
)
[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 QRectF::getRect(double* x, double* y, double* w, double* 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_double[src]

Returns the height of the rectangle.

Calls C++ function: double QRectF::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<QRectF>>
) -> CppBox<QRectF>
[src]

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

Calls C++ function: QRectF QRectF::intersected(const QRectF& 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<QRectF>>) -> bool[src]

Returns true if this rectangle intersects with the given rectangle (i.e. there is a non-empty area of overlap between them), otherwise returns false.

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

C++ documentation:

Returns true if this rectangle intersects with the given rectangle (i.e. there is a non-empty area of overlap between them), 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 QRectF::isEmpty() const.

C++ documentation:

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

An empty rectangle has width() <= 0 or height() <= 0. 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 QRectF::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. A null rectangle is also empty, and hence 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 QRectF::isValid() const.

C++ documentation:

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

A valid rectangle has a width() > 0 and height() > 0. 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_double[src]

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

Calls C++ function: double QRectF::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<QMarginsF>>
) -> CppBox<QRectF>
[src]

Returns a rectangle grown by the margins.

Calls C++ function: QRectF QRectF::marginsAdded(const QMarginsF& margins) const.

C++ documentation:

Returns a rectangle grown by the margins.

This function was introduced in Qt 5.3.

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

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

Removes the margins from the rectangle, shrinking it.

Calls C++ function: QRectF QRectF::marginsRemoved(const QMarginsF& margins) const.

C++ documentation:

Removes the margins from the rectangle, shrinking it.

This function was introduced in Qt 5.3.

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

pub unsafe fn move_bottom(&mut self, pos: c_double)[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 QRectF::moveBottom(double 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<QPointF>>)[src]

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

Calls C++ function: void QRectF::moveBottomLeft(const QPointF& 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<QPointF>>)[src]

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

Calls C++ function: void QRectF::moveBottomRight(const QPointF& p).

C++ documentation:

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

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

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

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

Calls C++ function: void QRectF::moveCenter(const QPointF& 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_double)[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 QRectF::moveLeft(double 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_double)[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 QRectF::moveRight(double 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_double, y: c_double)[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 QRectF::moveTo(double x, double y).

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<QPointF>>)[src]

This is an overloaded function.

Calls C++ function: void QRectF::moveTo(const QPointF& p).

C++ documentation:

This is an overloaded function.

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

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

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

Calls C++ function: void QRectF::moveTop(double pos).

C++ documentation:

Moves the rectangle vertically, leaving the rectangle's top line 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<QPointF>>)[src]

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

Calls C++ function: void QRectF::moveTopLeft(const QPointF& 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<QPointF>>)[src]

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

Calls C++ function: void QRectF::moveTopRight(const QPointF& 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<QRectF>[src]

Constructs a null rectangle.

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

C++ documentation:

Constructs a null rectangle.

See also isNull().

pub unsafe fn from_q_point_f_q_size_f(
    topleft: impl CastInto<Ref<QPointF>>,
    size: impl CastInto<Ref<QSizeF>>
) -> CppBox<QRectF>
[src]

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

Calls C++ function: [constructor] void QRectF::QRectF(const QPointF& topleft, const QSizeF& size).

C++ documentation:

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

See also setTopLeft() and setSize().

pub unsafe fn from_2_q_point_f(
    topleft: impl CastInto<Ref<QPointF>>,
    bottom_right: impl CastInto<Ref<QPointF>>
) -> CppBox<QRectF>
[src]

Constructs a rectangle with the given topLeft and bottomRight corners.

Calls C++ function: [constructor] void QRectF::QRectF(const QPointF& topleft, const QPointF& bottomRight).

C++ documentation:

Constructs a rectangle with the given topLeft and bottomRight corners.

This function was introduced in Qt 4.3.

See also setTopLeft() and setBottomRight().

pub unsafe fn from_4_double(
    left: c_double,
    top: c_double,
    width: c_double,
    height: c_double
) -> CppBox<QRectF>
[src]

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

Calls C++ function: [constructor] void QRectF::QRectF(double left, double top, double width, double 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 from_q_rect(rect: impl CastInto<Ref<QRect>>) -> CppBox<QRectF>[src]

Constructs a QRectF rectangle from the given QRect rectangle.

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

C++ documentation:

Constructs a QRectF rectangle from the given QRect rectangle.

See also toRect().

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

The QRectF class defines a rectangle in the plane using floating point precision.

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

C++ documentation:

The QRectF class defines a rectangle in the plane using floating point precision.

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

A QRectF can be constructed with a set of left, top, width and height coordinates, or from a QPointF and a QSizeF. The following code creates two identical rectangles.

QRectF r1(100.0, 200.1, 11.2, 16.3); QRectF r2(QPointF(100.0, 200.1), QSizeF(11.2, 16.3));

There is also a third constructor creating a QRectF from a QRect, and a corresponding toRect() function that returns a QRect object based on the values of this rectangle (note that the coordinates in the returned rectangle are rounded to the nearest integer).

The QRectF class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRectF 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 QSizeF. 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 (otherwise false). The QRectF 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 the rectangle's width or height is less than, or equal to, 0. Note that an empty rectangle is not valid: The isValid() function returns true if both width and height is larger than 0. 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 QRectF is defined in essentially the same way as QRect.

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

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

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

Calls C++ function: QRectF QRectF::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_double[src]

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

Calls C++ function: double QRectF::right() const.

C++ documentation:

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

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

pub unsafe fn set_bottom(&mut self, pos: c_double)[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 QRectF::setBottom(double 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<QPointF>>)[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 QRectF::setBottomLeft(const QPointF& 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<QPointF>>)[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 QRectF::setBottomRight(const QPointF& 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_double,
    y1: c_double,
    x2: c_double,
    y2: c_double
)
[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 QRectF::setCoords(double x1, double y1, double x2, double 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_double)[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 QRectF::setHeight(double 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_double)[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 QRectF::setLeft(double 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_double,
    y: c_double,
    w: c_double,
    h: c_double
)
[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 QRectF::setRect(double x, double y, double w, double 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_double)[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 QRectF::setRight(double 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<QSizeF>>)[src]

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

Calls C++ function: void QRectF::setSize(const QSizeF& 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_double)[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 QRectF::setTop(double 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<QPointF>>)[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 QRectF::setTopLeft(const QPointF& 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<QPointF>>)[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 QRectF::setTopRight(const QPointF& 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_double)[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 QRectF::setWidth(double 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, pos: c_double)[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 QRectF::setX(double 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 setLeft().

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

pub unsafe fn set_y(&mut self, pos: c_double)[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 QRectF::setY(double 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 setTop().

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

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

Returns the size of the rectangle.

Calls C++ function: QSizeF QRectF::size() const.

C++ documentation:

Returns the size of the rectangle.

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

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

Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle that completely contains this rectangle.

Calls C++ function: QRect QRectF::toAlignedRect() const.

C++ documentation:

Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle that completely contains this rectangle.

This function was introduced in Qt 4.3.

See also toRect().

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

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

Calls C++ function: QRect QRectF::toRect() const.

C++ documentation:

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

See also QRectF() and toAlignedRect().

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

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

Calls C++ function: double QRectF::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<QPointF>[src]

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

Calls C++ function: QPointF QRectF::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<QPointF>[src]

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

Calls C++ function: QPointF QRectF::topRight() const.

C++ documentation:

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

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

pub unsafe fn translate_2a(&mut self, dx: c_double, dy: c_double)[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 downwards.

Calls C++ function: void QRectF::translate(double dx, double 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 downwards.

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

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

This is an overloaded function.

Calls C++ function: void QRectF::translate(const QPointF& 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_double, dy: c_double) -> CppBox<QRectF>[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: QRectF QRectF::translated(double dx, double 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<QPointF>>
) -> CppBox<QRectF>
[src]

This is an overloaded function.

Calls C++ function: QRectF QRectF::translated(const QPointF& 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<QRectF>[src]

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

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

C++ documentation:

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


  QRectF r = {1.5, 5.1, 4.2, 2.4};
  r = r.transposed(); // r == {1.5, 5.1, 2.4, 4.2}

This function was introduced in Qt 5.7.

See also QSizeF::transposed().

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

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

Calls C++ function: QRectF QRectF::united(const QRectF& 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_double[src]

Returns the width of the rectangle.

Calls C++ function: double QRectF::width() const.

C++ documentation:

Returns the width of the rectangle.

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

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

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

Calls C++ function: double QRectF::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_double[src]

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

Calls C++ function: double QRectF::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 PartialEq<Ref<QRectF>> for QRectF[src]

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

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

Calls C++ function: bool operator==(const QRectF& arg1, const QRectF& 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<'_> Sub<Ref<QMarginsF>> for &'_ QRectF[src]

type Output = CppBox<QRectF>

The resulting type after applying the - operator.

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

Calls C++ function: QRectF operator-(const QRectF& lhs, const QMarginsF& rhs).

impl<'_> Add<Ref<QMarginsF>> for &'_ QRectF[src]

type Output = CppBox<QRectF>

The resulting type after applying the + operator.

fn add(self, rhs: Ref<QMarginsF>) -> CppBox<QRectF>[src]

Calls C++ function: QRectF operator+(const QRectF& lhs, const QMarginsF& rhs).

impl AddAssign<Ref<QMarginsF>> for QRectF[src]

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

Adds the margins to the rectangle, growing it.

Calls C++ function: QRectF& QRectF::operator+=(const QMarginsF& margins).

C++ documentation:

Adds the margins to the rectangle, growing it.

This function was introduced in Qt 5.3.

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

impl SubAssign<Ref<QMarginsF>> for QRectF[src]

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

Returns a rectangle shrunk by the margins.

Calls C++ function: QRectF& QRectF::operator-=(const QMarginsF& margins).

C++ documentation:

Returns a rectangle shrunk by the margins.

This function was introduced in Qt 5.3.

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

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

type Output = CppBox<QRectF>

The resulting type after applying the & operator.

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

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

Calls C++ function: QRectF QRectF::operator&(const QRectF& 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<'_> BitOr<Ref<QRectF>> for &'_ QRectF[src]

type Output = CppBox<QRectF>

The resulting type after applying the | operator.

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

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

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

C++ documentation:

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

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

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

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

Intersects this rectangle with the given rectangle.

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

C++ documentation:

Intersects this rectangle with the given rectangle.

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

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

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

Unites this rectangle with the given rectangle.

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

C++ documentation:

Unites this rectangle with the given rectangle.

See also united() and operator|().

impl CppDeletable for QRectF[src]

unsafe fn delete(&mut self)[src]

The QRectF class defines a rectangle in the plane using floating point precision.

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

C++ documentation:

The QRectF class defines a rectangle in the plane using floating point precision.

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

A QRectF can be constructed with a set of left, top, width and height coordinates, or from a QPointF and a QSizeF. The following code creates two identical rectangles.

QRectF r1(100.0, 200.1, 11.2, 16.3); QRectF r2(QPointF(100.0, 200.1), QSizeF(11.2, 16.3));

There is also a third constructor creating a QRectF from a QRect, and a corresponding toRect() function that returns a QRect object based on the values of this rectangle (note that the coordinates in the returned rectangle are rounded to the nearest integer).

The QRectF class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRectF 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 QSizeF. 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 (otherwise false). The QRectF 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 the rectangle's width or height is less than, or equal to, 0. Note that an empty rectangle is not valid: The isValid() function returns true if both width and height is larger than 0. 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 QRectF is defined in essentially the same way as QRect.

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

impl Size for QRectF[src]

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

Returns the size of the rectangle.

Calls C++ function: QSizeF QRectF::size() const.

C++ documentation:

Returns the size of the rectangle.

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

Auto Trait Implementations

impl Send for QRectF

impl Sync for QRectF

impl Unpin for QRectF

impl UnwindSafe for QRectF

impl RefUnwindSafe for QRectF

Blanket Implementations

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

impl<T> From<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.

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

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

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

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

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