QRectF
description
Hierarchy
↳ QRectF
Index
Constructors
Properties
Methods
- adjust
- adjusted
- bottom
- bottomLeft
- bottomRight
- center
- contains
- height
- intersected
- intersects
- isEmpty
- isNull
- isValid
- left
- moveBottom
- moveBottomLeft
- moveBottomRight
- moveCenter
- moveLeft
- moveRight
- moveTo
- moveTop
- moveTopLeft
- moveTopRight
- normalized
- right
- setBottom
- setBottomLeft
- setBottomRight
- setCoords
- setHeight
- setLeft
- setRect
- setRight
- setTop
- setTopLeft
- setTopRight
- setWidth
- setX
- setY
- toAlignedRect
- toRect
- top
- topLeft
- topRight
- translate
- translated
- transposed
- united
- width
- x
- y
Constructors
constructor
+ 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
Properties
native
• native: NativeElement | null
Inherited from Component.native
Methods
adjust
â–¸ 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
â–¸ 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
â–¸ bottom(): number
Returns the y-coordinate of the rectangle's bottom edge.
Returns: number
bottomLeft
â–¸ bottomLeft(): QPointF
Returns the position of the rectangle's bottom-left corner.
Returns: QPointF
bottomRight
â–¸ bottomRight(): QPointF
Returns the position of the rectangle's bottom-right corner.
Returns: QPointF
center
â–¸ center(): QPointF
Returns the center point of the rectangle.
Returns: QPointF
contains
â–¸ 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
â–¸ height(): number
Returns the height of the rectangle.
Returns: number
intersected
â–¸ 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
â–¸ 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
â–¸ isEmpty(): boolean
Returns true if the rectangle is empty, otherwise returns false.
Returns: boolean
isNull
â–¸ isNull(): boolean
Returns true if the rectangle is a null rectangle, otherwise returns false.
Returns: boolean
isValid
â–¸ isValid(): boolean
Returns true if the rectangle is valid, otherwise returns false.
Returns: boolean
left
â–¸ left(): number
Returns the x-coordinate of the rectangle's left edge. Equivalent to x().
Returns: number
moveBottom
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ normalized(): QRectF
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.
Returns: QRectF
right
â–¸ right(): number
Returns the x-coordinate of the rectangle's right edge.
Returns: number
setBottom
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ 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
â–¸ top(): number
Returns the y-coordinate of the rectangle's top edge. Equivalent to y().
Returns: number
topLeft
â–¸ topLeft(): QPointF
Returns the position of the rectangle's top-left corner.
Returns: QPointF
topRight
â–¸ topRight(): QPointF
Returns the position of the rectangle's top-right corner.
Returns: QPointF
translate
â–¸ 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
â–¸ 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
â–¸ transposed(): QRectF
Returns a copy of the rectangle that has its width and height exchanged:
Returns: QRectF
united
â–¸ united(rectangle
: QRectF): QRectF
Returns the bounding rectangle of this rectangle and the given rectangle.
Parameters:
Name | Type |
---|---|
rectangle | QRectF |
Returns: QRectF
width
â–¸ width(): number
Returns the width of the rectangle.
Returns: number
x
â–¸ x(): number
Returns the x-coordinate of the rectangle's left edge. Equivalent to left().
Returns: number
y
â–¸ y(): number
Returns the y-coordinate of the rectangle's top edge. Equivalent to top().
Returns: number