Skip to main content

QRectF

description

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new QRectF(nativeOrX?: NativeElement | number, y: number, width: number, height: number): QRectF

Overrides Component.constructor

Parameters:

NameTypeDefault
nativeOrX?NativeElement | number-
ynumber0
widthnumber0
heightnumber0

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:

NameType
dx1number
dy1number
dx2number
dy2number

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:

NameType
dx1number
dy1number
dx2number
dy2number

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:

NameType
arg0QRectF | number | QPointF
ynumber

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:

NameType
rectangleQRectF

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:

NameType
rectangleQRectF

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:

NameType
ynumber

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:

NameType
positionQPointF

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:

NameType
positionQPointF

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:

NameType
positionQPointF

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:

NameType
xnumber

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:

NameType
xnumber

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:

NameType
xOrPosnumber | QPointF
ynumber

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:

NameType
ynumber

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:

NameType
positionQPointF

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:

NameType
positionQPointF

Returns: void


normalized

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

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:

NameType
ynumber

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:

NameType
positionQPointF

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:

NameType
positionQPointF

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:

NameType
x1number
y1number
x2number
y2number

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:

NameType
heightnumber

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:

NameType
xnumber

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:

NameType
xnumber
ynumber
widthnumber
heightnumber

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:

NameType
xnumber

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:

NameType
ynumber

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:

NameType
positionQPointF

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:

NameType
positionQPointF

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:

NameType
widthnumber

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:

NameType
xnumber

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:

NameType
ynumber

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:

NameType
dxOrOffsetnumber | QPointF
dynumber

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:

NameType
dxOrOffsetnumber | QPointF
dynumber

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:

NameType
rectangleQRectF

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