website/docs/api/generated/classes/qrectf.md
description
↳ QRectF
+ new QRectF(nativeOrX?: NativeElement | number, y: number, width: number, height: number): QRectF
Overrides Component.constructor
Parameters:
| Name | Type | Default |
|---|---|---|
nativeOrX? | NativeElement | number | - |
y | number | 0 |
width | number | 0 |
height | number | 0 |
Returns: QRectF
• native: NativeElement | null
Inherited from Component.native
▸ adjust(dx1: number, dy1: number, dx2: number, dy2: number): void
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Parameters:
| Name | Type |
|---|---|
dx1 | number |
dy1 | number |
dx2 | number |
dy2 | number |
Returns: void
▸ adjusted(dx1: number, dy1: number, dx2: number, dy2: number): QRectF
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of this rectangle.
Parameters:
| Name | Type |
|---|---|
dx1 | number |
dy1 | number |
dx2 | number |
dy2 | number |
Returns: QRectF
▸ bottom(): number
Returns the y-coordinate of the rectangle's bottom edge.
Returns: number
▸ bottomLeft(): QPointF
Returns the position of the rectangle's bottom-left corner.
Returns: QPointF
▸ bottomRight(): QPointF
Returns the position of the rectangle's bottom-right corner.
Returns: QPointF
▸ center(): QPointF
Returns the center point of the rectangle.
Returns: QPointF
▸ contains(arg0: QRectF | number | QPointF, y: number): boolean
Returns true if the given point is inside or on the edge of the rectangle; otherwise returns false.
Parameters:
| Name | Type |
|---|---|
arg0 | QRectF | number | QPointF |
y | number |
Returns: boolean
▸ height(): number
Returns the height of the rectangle.
Returns: number
▸ intersected(rectangle: QRectF): QRectF
Returns the intersection of this rectangle and the given rectangle. Note that r.intersected(s) is equivalent to r & s.
Parameters:
| Name | Type |
|---|---|
rectangle | QRectF |
Returns: QRectF
▸ intersects(rectangle: QRectF): boolean
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.
Parameters:
| Name | Type |
|---|---|
rectangle | QRectF |
Returns: boolean
▸ isEmpty(): boolean
Returns true if the rectangle is empty, otherwise returns false.
Returns: boolean
▸ isNull(): boolean
Returns true if the rectangle is a null rectangle, otherwise returns false.
Returns: boolean
▸ isValid(): boolean
Returns true if the rectangle is valid, otherwise returns false.
Returns: boolean
▸ left(): number
Returns the x-coordinate of the rectangle's left edge. Equivalent to x().
Returns: number
▸ moveBottom(y: number): void
Moves the rectangle vertically, leaving the rectangle's bottom edge at the given y coordinate. The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
y | number |
Returns: void
▸ moveBottomLeft(position: QPointF): void
Moves the rectangle, leaving the bottom-left corner at the given position. The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
position | QPointF |
Returns: void
▸ moveBottomRight(position: QPointF): void
Moves the rectangle, leaving the bottom-right corner at the given position. The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
position | QPointF |
Returns: void
▸ moveCenter(position: QPointF): void
Moves the rectangle, leaving the center point at the given position. The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
position | QPointF |
Returns: void
▸ moveLeft(x: number): void
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate. The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
x | number |
Returns: void
▸ moveRight(x: number): void
Moves the rectangle horizontally, leaving the rectangle's right edge at the given x coordinate. The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
x | number |
Returns: void
▸ moveTo(xOrPos: number | QPointF, y: number): void
Moves the rectangle, leaving the top-left corner at the given position (x, y). The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
xOrPos | number | QPointF |
y | number |
Returns: void
▸ moveTop(y: number): void
Moves the rectangle vertically, leaving the rectangle's top line at the given y coordinate. The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
y | number |
Returns: void
▸ moveTopLeft(position: QPointF): void
Moves the rectangle, leaving the top-left corner at the given position. The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
position | QPointF |
Returns: void
▸ moveTopRight(position: QPointF): void
Moves the rectangle, leaving the top-right corner at the given position. The rectangle's size is unchanged.
Parameters:
| Name | Type |
|---|---|
position | QPointF |
Returns: void
▸ normalized(): QRectF
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.
Returns: QRectF
▸ right(): number
Returns the x-coordinate of the rectangle's right edge.
Returns: number
▸ setBottom(y: number): void
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.
Parameters:
| Name | Type |
|---|---|
y | number |
Returns: void
▸ setBottomLeft(position: QPointF): void
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.
Parameters:
| Name | Type |
|---|---|
position | QPointF |
Returns: void
▸ setBottomRight(position: QPointF): void
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.
Parameters:
| Name | Type |
|---|---|
position | QPointF |
Returns: void
▸ setCoords(x1: number, y1: number, x2: number, y2: number): void
Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its bottom-right corner to (x2, y2).
Parameters:
| Name | Type |
|---|---|
x1 | number |
y1 | number |
x2 | number |
y2 | number |
Returns: void
▸ setHeight(height: number): void
Sets the height of the rectangle to the given height. The bottom edge is changed, but not the top one.
Parameters:
| Name | Type |
|---|---|
height | number |
Returns: void
▸ setLeft(x: number): void
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.
Parameters:
| Name | Type |
|---|---|
x | number |
Returns: void
▸ setRect(x: number, y: number, width: number, height: number): void
Sets the coordinates of the rectangle's top-left corner to (x, y), and its size to the given width and height.
Parameters:
| Name | Type |
|---|---|
x | number |
y | number |
width | number |
height | number |
Returns: void
▸ setRight(x: number): void
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.
Parameters:
| Name | Type |
|---|---|
x | number |
Returns: void
▸ setTop(y: number): void
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.
Parameters:
| Name | Type |
|---|---|
y | number |
Returns: void
▸ setTopLeft(position: QPointF): void
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.
Parameters:
| Name | Type |
|---|---|
position | QPointF |
Returns: void
▸ setTopRight(position: QPointF): void
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.
Parameters:
| Name | Type |
|---|---|
position | QPointF |
Returns: void
▸ setWidth(width: number): void
Sets the width of the rectangle to the given width. The right edge is changed, but not the left one.
Parameters:
| Name | Type |
|---|---|
width | number |
Returns: void
▸ setX(x: number): void
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.
Parameters:
| Name | Type |
|---|---|
x | number |
Returns: void
▸ setY(y: number): void
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.
Parameters:
| Name | Type |
|---|---|
y | number |
Returns: void
▸ toAlignedRect(): QRect
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle that completely contains this rectangle.
Returns: QRect
▸ toRect(): QRect
Returns a QRect based on the values of this rectangle. Note that the coordinates in the returned rectangle are rounded to the nearest integer.
Returns: QRect
▸ top(): number
Returns the y-coordinate of the rectangle's top edge. Equivalent to y().
Returns: number
▸ topLeft(): QPointF
Returns the position of the rectangle's top-left corner.
Returns: QPointF
▸ topRight(): QPointF
Returns the position of the rectangle's top-right corner.
Returns: QPointF
▸ translate(dxOrOffset: number | QPointF, dy: number): void
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.
Parameters:
| Name | Type |
|---|---|
dxOrOffset | number | QPointF |
dy | number |
Returns: void
▸ translated(dxOrOffset: number | QPointF, dy: number): QRectF
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.
Parameters:
| Name | Type |
|---|---|
dxOrOffset | number | QPointF |
dy | number |
Returns: QRectF
▸ transposed(): QRectF
Returns a copy of the rectangle that has its width and height exchanged:
Returns: QRectF
▸ united(rectangle: QRectF): QRectF
Returns the bounding rectangle of this rectangle and the given rectangle.
Parameters:
| Name | Type |
|---|---|
rectangle | QRectF |
Returns: QRectF
▸ width(): number
Returns the width of the rectangle.
Returns: number
▸ x(): number
Returns the x-coordinate of the rectangle's left edge. Equivalent to left().
Returns: number
▸ y(): number
Returns the y-coordinate of the rectangle's top edge. Equivalent to top().
Returns: number