QRectF Class

QRectF 클래스는 부동 소수점 정밀도를 사용하여 평면에서 유한 직사각형을 정의합니다. 더 보기...

Header: #include <QRectF>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

이 클래스는 동등 비교 가능합니다.

이 클래스는 QRect동등 비교 가능합니다.

참고: 이 클래스의 모든 함수는 재진입합니다.

공용 함수

QRectF()
QRectF(const QRect &rectangle)
QRectF(const QPointF &topLeft, const QPointF &bottomRight)
QRectF(const QPointF &topLeft, const QSizeF &size)
QRectF(qreal x, qreal y, qreal width, qreal height)
void adjust(qreal dx1, qreal dy1, qreal dx2, qreal dy2)
QRectF adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const
qreal bottom() const
QPointF bottomLeft() const
QPointF bottomRight() const
QPointF center() const
bool contains(const QPointF &point) const
bool contains(const QRectF &rectangle) const
bool contains(qreal x, qreal y) const
void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const
void getRect(qreal *x, qreal *y, qreal *width, qreal *height) const
qreal height() const
QRectF intersected(const QRectF &rectangle) const
bool intersects(const QRectF &rectangle) const
bool isEmpty() const
bool isNull() const
bool isValid() const
qreal left() const
QRectF marginsAdded(const QMarginsF &margins) const
QRectF marginsRemoved(const QMarginsF &margins) const
void moveBottom(qreal y)
void moveBottomLeft(const QPointF &position)
void moveBottomRight(const QPointF &position)
void moveCenter(const QPointF &position)
void moveLeft(qreal x)
void moveRight(qreal x)
void moveTo(qreal x, qreal y)
void moveTo(const QPointF &position)
void moveTop(qreal y)
void moveTopLeft(const QPointF &position)
void moveTopRight(const QPointF &position)
QRectF normalized() const
qreal right() const
void setBottom(qreal y)
void setBottomLeft(const QPointF &position)
void setBottomRight(const QPointF &position)
void setCoords(qreal x1, qreal y1, qreal x2, qreal y2)
void setHeight(qreal height)
void setLeft(qreal x)
void setRect(qreal x, qreal y, qreal width, qreal height)
void setRight(qreal x)
void setSize(const QSizeF &size)
void setTop(qreal y)
void setTopLeft(const QPointF &position)
void setTopRight(const QPointF &position)
void setWidth(qreal width)
void setX(qreal x)
void setY(qreal y)
QSizeF size() const
QRect toAlignedRect() const
CGRect toCGRect() const
(since 6.5) emscripten::val toDOMRect() const
QRect toRect() const
qreal top() const
QPointF topLeft() const
QPointF topRight() const
void translate(qreal dx, qreal dy)
void translate(const QPointF &offset)
QRectF translated(qreal dx, qreal dy) const
QRectF translated(const QPointF &offset) const
QRectF transposed() const
QRectF united(const QRectF &rectangle) const
qreal width() const
qreal x() const
qreal y() const
QRectF operator&(const QRectF &rectangle) const
QRectF &operator&=(const QRectF &rectangle)
QRectF &operator+=(const QMarginsF &margins)
QRectF &operator-=(const QMarginsF &margins)
QRectF operator|(const QRectF &rectangle) const
QRectF &operator|=(const QRectF &rectangle)

정적 공용 멤버

QRectF fromCGRect(CGRect rect)
(since 6.5) QRectF fromDOMRect(emscripten::val domRect)
(since 6.8) bool qFuzzyCompare(const QRectF &lhs, const QRectF &rhs)
(since 6.8) bool qFuzzyIsNull(const QRectF &rect)
bool operator!=(const QRectF &lhs, const QRectF &rhs)
QRectF operator+(const QMarginsF &lhs, const QRectF &rhs)
QRectF operator+(const QRectF &lhs, const QMarginsF &rhs)
QRectF operator-(const QRectF &lhs, const QMarginsF &rhs)
QDataStream &operator<<(QDataStream &stream, const QRectF &rectangle)
bool operator==(const QRectF &lhs, const QRectF &rhs)
QDataStream &operator>>(QDataStream &stream, QRectF &rectangle)

상세 설명

직사각형은 일반적으로 왼쪽 상단 모서리와 크기로 표현됩니다. QRectF의 크기(너비와 높이)는 항상 렌더링의 기초가 되는 수학적 직사각형과 동일합니다.

QRectF는 왼쪽, 위쪽, 너비 및 높이 좌표 집합으로 만들거나 QPointFQSizeF 에서 만들 수 있습니다. 다음 코드는 두 개의 동일한 직사각형을 만듭니다.

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

또한 QRect 에서 QRectF를 생성하는 세 번째 생성자와 이 사각형의 값을 기반으로 QRect 객체를 반환하는 해당 toRect() 함수도 있습니다(반환된 사각형의 좌표는 가장 가까운 정수로 반올림됨을 참고하세요).

QRectF 클래스는 다양한 직사각형 좌표를 반환하고 이를 조작할 수 있는 함수 모음을 제공합니다. QRectF는 다양한 좌표를 기준으로 직사각형을 이동하는 함수도 제공합니다. 또한 직사각형의 왼쪽 상단 모서리를 주어진 좌표에 두고 직사각형을 이동하는 moveTo() 함수가 있습니다. 또는 translate() 함수는 현재 위치를 기준으로 주어진 오프셋만큼 직사각형을 이동하고 translated() 함수는 이 직사각형의 번역된 사본을 반환합니다.

size() 함수는 사각형의 치수를 QSizeF 로 반환합니다. width() 및 height() 함수를 사용하여 치수를 개별적으로 검색할 수도 있습니다. 치수를 조작하려면 setSize(), setWidth() 또는 setHeight() 함수를 사용합니다. 또는 직사각형 좌표를 설정하는 함수(예: setBottom() 또는 setRight())를 적용하여 크기를 변경할 수도 있습니다.

contains() 함수는 주어진 점이 직사각형 안에 있는지 여부를 알려주고 intersects() 함수는 이 직사각형이 주어진 사각형과 교차하면 true (그렇지 않으면 거짓)을 반환합니다. QRectF 클래스는 또한 교차 사각형을 반환하는 intersected() 함수와 주어진 사각형과 이 사각형을 둘러싸는 사각형을 반환하는 united() 함수를 제공합니다:

isEmpty() 함수는 직사각형의 너비 또는 높이가 0보다 작거나 같으면 true 을 반환합니다. 빈 직사각형은 유효하지 않다는 점에 유의하세요: isValid () 함수는 너비와 높이가 모두 0보다 큰 경우 true 을 반환합니다. 반면에 널 사각형(isNull() == true)은 너비와 높이가 모두 0으로 설정되어 있습니다.

QRect 및 QRectF가 정의되는 방식 때문에 빈 QRectF는 QRect 과 본질적으로 동일한 방식으로 정의됩니다.

마지막으로 QRectF 객체를 스트리밍할 수 있을 뿐만 아니라 비교할 수도 있습니다.

렌더링

anti-aliased 페인터를 사용하는 경우 QRectF의 경계선은 수학 직사각형의 경계선 양쪽에 대칭으로 렌더링됩니다. 그러나 에일리어스 페인터(기본값)를 사용하는 경우 다른 규칙이 적용됩니다.

그런 다음 1픽셀 너비의 펜으로 렌더링할 때 QRectF의 경계선은 수학 사각형의 경계선 오른쪽과 아래에 렌더링됩니다.

2픽셀 너비의 펜으로 렌더링하면 경계선이 수학 직사각형에 의해 가운데로 분할됩니다. 펜이 짝수 픽셀로 설정된 경우에는 홀수 픽셀의 펜으로 렌더링하는 동안 여분의 픽셀이 1픽셀의 경우와 마찬가지로 수학 직사각형의 오른쪽과 아래에 렌더링됩니다.

논리적 표현1픽셀 너비의 펜
2픽셀 너비의 펜3픽셀 너비의 펜

좌표

QRectF 클래스는 다양한 직사각형 좌표를 반환하고 이를 조작할 수 있는 함수 모음을 제공합니다. QRectF는 다양한 좌표를 기준으로 직사각형을 이동하는 함수도 제공합니다.

예를 들어 bottom(), setBottom() 및 moveBottom() 함수: bottom()는 직사각형의 아래쪽 가장자리의 y 좌표를 반환하고, setBottom()는 직사각형의 아래쪽 가장자리를 지정된 y 좌표로 설정하며(높이는 변경할 수 있지만 직사각형의 위쪽 가장자리는 변경하지 않음), moveBottom()는 직사각형 전체를 수직으로 이동하여 주어진 y 좌표와 크기는 그대로 두고 직사각형의 아래쪽 가장자리를 변경하지 않음으로써 전체 직사각형이 수직으로 이동합니다.

adjust() 함수를 사용하여 이 사각형의 좌표에 오프셋을 추가할 수도 있고 adjusted() 함수를 사용하여 원래 사각형의 조정을 기반으로 새 사각형을 검색할 수도 있습니다. 너비와 높이 중 하나가 음수인 경우 normalized() 함수를 사용하여 모서리가 바뀐 직사각형을 검색할 수 있습니다.

또한 QRectF는 직사각형의 왼쪽 상단과 오른쪽 하단 모서리의 위치를 추출하는 getCoords() 함수와 직사각형의 왼쪽 상단 모서리, 너비 및 높이를 추출하는 getRect() 함수를 제공합니다. setCoords () 및 setRect() 함수를 사용하면 직사각형의 좌표와 치수를 한 번에 조작할 수 있습니다.

QRectQRegion참조하세요 .

멤버 함수 문서

[constexpr noexcept] QRectF::QRectF()

널 사각형을 만듭니다.

isNull()도 참조하세요 .

[constexpr noexcept] QRectF::QRectF(const QRect &rectangle)

주어진 QRect rectangle 에서 QRectF 사각형을 생성합니다.

참고: 이 함수는 QRect::toRectF()와 마찬가지로 rectanglesize()을 유지하며, bottomRight()의 모서리는 유지하지 않습니다.

toRect() 및 QRect::toRectF()도 참조하세요 .

[constexpr noexcept] QRectF::QRectF(const QPointF &topLeft, const QPointF &bottomRight)

주어진 topLeftbottomRight 모서리가 있는 직사각형을 만듭니다.

setTopLeft() 및 setBottomRight()도 참조하세요 .

[constexpr noexcept] QRectF::QRectF(const QPointF &topLeft, const QSizeF &size)

주어진 topLeft 모서리와 주어진 size 로 직사각형을 만듭니다.

setTopLeft() 및 setSize()도 참조하세요 .

[constexpr noexcept] QRectF::QRectF(qreal x, qreal y, qreal width, qreal height)

(x, y)을 왼쪽 상단 모서리로 하고 주어진 widthheight 을 사용하여 직사각형을 구성합니다. 모든 매개변수는 유한해야 합니다.

setRect()도 참조하세요 .

[constexpr noexcept] void QRectF::adjust(qreal dx1, qreal dy1, qreal dx2, qreal dy2)

직사각형의 기존 좌표에 각각 dx1, dy1, dx2dy2 을 추가합니다. 모든 매개변수는 유한해야 합니다.

adjusted() 및 setRect()도 참조하세요 .

[constexpr noexcept] QRectF QRectF::adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const

이 직사각형의 기존 좌표에 각각 dx1, dy1, dx2dy2 을 추가한 새 직사각형을 반환합니다. 모든 매개변수는 유한해야 합니다.

adjust()도 참조하세요 .

[constexpr noexcept] qreal QRectF::bottom() const

직사각형의 아래쪽 가장자리의 y 좌표를 반환합니다.

setBottom(), bottomLeft() 및 bottomRight()도 참조하세요 .

[constexpr noexcept] QPointF QRectF::bottomLeft() const

직사각형의 왼쪽 하단 모서리 위치를 반환합니다.

setBottomLeft(), bottom() 및 left()도 참조하세요 .

[constexpr noexcept] QPointF QRectF::bottomRight() const

직사각형의 오른쪽 하단 모서리 위치를 반환합니다.

setBottomRight(), bottom() 및 right()도 참조하세요 .

[constexpr noexcept] QPointF QRectF::center() const

직사각형의 중심점을 반환합니다.

moveCenter()도 참조하세요 .

[noexcept] bool QRectF::contains(const QPointF &point) const

주어진 point 이 직사각형의 안쪽이나 가장자리에 있으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

intersects()도 참조하세요 .

[noexcept] bool QRectF::contains(const QRectF &rectangle) const

이 함수는 오버로드된 함수입니다.

주어진 rectangle 이 이 사각형 안에 있으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

[noexcept] bool QRectF::contains(qreal x, qreal y) const

이 함수는 오버로드된 함수입니다.

점(x, y)이 직사각형의 내부 또는 가장자리에 있으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

[static noexcept] QRectF QRectF::fromCGRect(CGRect rect)

CGRect rect 에서 QRectF 을 생성합니다.

toCGRect()도 참조하세요 .

[static, since 6.5] QRectF QRectF::fromDOMRect(emscripten::val domRect)

DOMRect (https://www.w3.org/TR/geometry-1/) domRectQRectF 로 변환합니다. 제공된 파라미터가 DOMRect가 아닌 경우 동작이 정의되지 않습니다.

이 함수는 Qt 6.5에 도입되었습니다.

toDOMRect()도 참조하십시오 .

[constexpr] void QRectF::getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const

직사각형의 왼쪽 상단 모서리 위치를 *x1 및 *y1 으로, 오른쪽 하단 모서리 위치를 *x2 및 *y2 으로 추출합니다.

setCoords() 및 getRect()도 참조하세요 .

[constexpr] void QRectF::getRect(qreal *x, qreal *y, qreal *width, qreal *height) const

직사각형의 왼쪽 상단 모서리 위치를 *x 및 *y 으로, 크기를 *width 및 *height 으로 추출합니다.

setRect() 및 getCoords()도 참조하세요 .

[constexpr noexcept] qreal QRectF::height() const

직사각형의 높이를 반환합니다.

setHeight(), width() 및 size()도 참조하세요 .

[noexcept] QRectF QRectF::intersected(const QRectF &rectangle) const

이 사각형과 주어진 rectangle 의 교집합을 반환합니다. r.intersected(s)r & s 과 동일합니다.

intersects(), united(), operator&=()도 참조하세요 .

[noexcept] bool QRectF::intersects(const QRectF &rectangle) const

이 사각형이 주어진 rectangle 과 교차하면 true 을 반환하고(즉, 둘 사이에 비어 있지 않은 겹치는 영역이 있는 경우), 그렇지 않으면 false 을 반환합니다.

교차 사각형은 intersected() 함수를 사용하여 검색할 수 있습니다.

contains()도 참조하세요 .

[constexpr noexcept] bool QRectF::isEmpty() const

사각형이 비어 있으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

빈 사각형은 width() <= 0 또는 height() <= 0입니다. 빈 사각형은 유효하지 않습니다(즉, isEmpty() == !isValid()).

모서리가 바뀐 직사각형을 검색하려면 normalized() 함수를 사용합니다.

isNull(), isValid() 및 normalized()도 참조하세요 .

[constexpr noexcept] bool QRectF::isNull() const

사각형이 널 사각형이면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

널 사각형은 너비와 높이가 모두 0으로 설정되어 있습니다. 널 사각형도 비어 있으므로 유효하지 않습니다.

isEmpty() 및 isValid()도 참조하세요 .

[constexpr noexcept] bool QRectF::isValid() const

사각형이 유효하면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

유효한 사각형은 width() > 0 및 height() > 0입니다. 유효하지 않은 사각형에는 교집합과 같은 사소한 연산이 정의되지 않는다는 점에 유의하세요. 유효한 사각형은 비어 있지 않습니다(즉, isValid() == !isEmpty()).

isNull(), isEmpty() 및 normalized()도 참조하세요 .

[constexpr noexcept] qreal QRectF::left() const

직사각형의 왼쪽 가장자리의 x 좌표를 반환합니다. x ()와 동일합니다.

setLeft(), topLeft() 및 bottomLeft()도 참조하세요 .

[constexpr noexcept] QRectF QRectF::marginsAdded(const QMarginsF &margins) const

margins 에 의해 커진 직사각형을 반환합니다.

operator+=(), marginsRemoved(), operator-=()도 참조하세요 .

[constexpr noexcept] QRectF QRectF::marginsRemoved(const QMarginsF &margins) const

직사각형에서 margins 을 제거하여 축소합니다.

marginsAdded(), operator+=() 및 operator-=()도 참조하세요 .

[constexpr noexcept] void QRectF::moveBottom(qreal y)

직사각형을 수직으로 이동하여 직사각형의 아래쪽 가장자리를 지정된 유한 y 좌표에 남깁니다. 직사각형의 크기는 변경되지 않습니다.

bottom(), setBottom() 및 moveTop()도 참조하세요 .

[constexpr noexcept] void QRectF::moveBottomLeft(const QPointF &position)

직사각형을 이동하여 왼쪽 하단 모서리를 지정된 position 에 남깁니다. 사각형의 크기는 변경되지 않습니다.

setBottomLeft(), moveBottom() 및 moveLeft()도 참조하세요 .

[constexpr noexcept] void QRectF::moveBottomRight(const QPointF &position)

직사각형을 이동하여 오른쪽 하단 모서리를 지정된 position 에 남깁니다. 사각형의 크기는 변경되지 않습니다.

setBottomRight(), moveBottom() 및 moveRight()도 참조하세요 .

[constexpr noexcept] void QRectF::moveCenter(const QPointF &position)

주어진 position 에 중심점을 두고 직사각형을 이동합니다. 직사각형의 크기는 변경되지 않습니다.

center()도 참조하세요 .

[constexpr noexcept] void QRectF::moveLeft(qreal x)

직사각형을 수평으로 이동하여 직사각형의 왼쪽 가장자리를 지정된 유한 x 좌표에 남깁니다. 직사각형의 크기는 변경되지 않습니다.

left(), setLeft() 및 moveRight()도 참조하세요 .

[constexpr noexcept] void QRectF::moveRight(qreal x)

직사각형을 수평으로 이동하여 직사각형의 오른쪽 가장자리를 지정된 유한 x 좌표에 남깁니다. 직사각형의 크기는 변경되지 않습니다.

right(), setRight() 및 moveLeft()도 참조하세요 .

[constexpr noexcept] void QRectF::moveTo(qreal x, qreal y)

직사각형을 이동하여 왼쪽 상단 모서리를 지정된 위치(x, y)에 남깁니다. 직사각형의 크기는 변경되지 않습니다. 두 매개변수는 모두 유한해야 합니다.

translate() 및 moveTopLeft()도 참조하세요 .

[constexpr noexcept] void QRectF::moveTo(const QPointF &position)

이 함수는 과부하된 함수입니다.

직사각형을 이동하여 왼쪽 상단 모서리를 지정된 position 에 남깁니다.

[constexpr noexcept] void QRectF::moveTop(qreal y)

직사각형을 수직으로 이동하여 직사각형의 위쪽 선을 지정된 유한 y 좌표에 남깁니다. 직사각형의 크기는 변경되지 않습니다.

top(), setTop() 및 moveBottom()도 참조하세요 .

[constexpr noexcept] void QRectF::moveTopLeft(const QPointF &position)

직사각형을 이동하여 왼쪽 상단 모서리를 지정된 position 에 남깁니다. 사각형의 크기는 변경되지 않습니다.

setTopLeft(), moveTop() 및 moveLeft()도 참조하세요 .

[constexpr noexcept] void QRectF::moveTopRight(const QPointF &position)

직사각형을 이동하여 오른쪽 상단 모서리를 지정된 position 에 남겨둡니다. 사각형의 크기는 변경되지 않습니다.

setTopRight(), moveTop() 및 moveRight()도 참조하세요 .

[noexcept] QRectF QRectF::normalized() const

정규화된 직사각형, 즉 너비와 높이가 음수가 아닌 직사각형을 반환합니다.

width() < 0이면 이 함수는 왼쪽과 오른쪽 모서리를 바꾸고 height() < 0이면 위쪽과 아래쪽 모서리를 바꿉니다.

isValid() 및 isEmpty()도 참조하세요 .

직사각형의 오른쪽 가장자리의 x 좌표를 반환합니다.

setRight(), topRight() 및 bottomRight()도 참조하세요 .

[constexpr noexcept] void QRectF::setBottom(qreal y)

직사각형의 아래쪽 가장자리를 지정된 유한 y 좌표로 설정합니다. 높이는 변경할 수 있지만 직사각형의 위쪽 가장자리는 변경하지 않습니다.

bottom() 및 moveBottom()도 참조하세요 .

[constexpr noexcept] void QRectF::setBottomLeft(const QPointF &position)

직사각형의 왼쪽 하단 모서리를 지정된 position 으로 설정합니다. 크기는 변경할 수 있지만 직사각형의 오른쪽 상단 모서리는 변경하지 않습니다.

bottomLeft() 및 moveBottomLeft()도 참조하세요 .

[constexpr noexcept] void QRectF::setBottomRight(const QPointF &position)

직사각형의 오른쪽 하단 모서리를 지정된 position 으로 설정합니다. 크기는 변경할 수 있지만 직사각형의 왼쪽 상단 모서리는 변경하지 않습니다.

bottomRight() 및 moveBottomRight()도 참조하세요 .

[constexpr noexcept] void QRectF::setCoords(qreal x1, qreal y1, qreal x2, qreal y2)

직사각형의 왼쪽 상단 모서리 좌표를 (x1, y1)로, 오른쪽 하단 모서리 좌표를 (x2, y2)로 설정합니다. 모든 매개변수는 유한해야 합니다.

getCoords() 및 setRect()도 참조하세요 .

[constexpr noexcept] void QRectF::setHeight(qreal height)

직사각형의 높이를 주어진 유한값 height 으로 설정합니다. 아래쪽 가장자리는 변경되지만 위쪽 가장자리는 변경되지 않습니다.

height() 및 setSize()도 참조하세요 .

[constexpr noexcept] void QRectF::setLeft(qreal x)

직사각형의 왼쪽 가장자리를 지정된 유한 x 좌표로 설정합니다. 너비는 변경할 수 있지만 직사각형의 오른쪽 가장자리는 변경하지 않습니다.

setX()와 동일합니다.

left() 및 moveLeft()도 참조하세요 .

[constexpr noexcept] void QRectF::setRect(qreal x, qreal y, qreal width, qreal height)

직사각형의 왼쪽 상단 모서리 좌표를 (x, y)로, 크기를 지정된 widthheight 로 설정합니다. 모든 매개변수는 유한해야 합니다.

getRect() 및 setCoords()도 참조하세요 .

[constexpr noexcept] void QRectF::setRight(qreal x)

직사각형의 오른쪽 가장자리를 주어진 유한 x 좌표로 설정합니다. 너비는 변경할 수 있지만 직사각형의 왼쪽 가장자리는 변경하지 않습니다.

right() 및 moveRight()도 참조하세요 .

[constexpr noexcept] void QRectF::setSize(const QSizeF &size)

직사각형의 크기를 주어진 유한값 size 으로 설정합니다. 왼쪽 상단 모서리는 이동하지 않습니다.

size(), setWidth() 및 setHeight()도 참조하세요 .

[constexpr noexcept] void QRectF::setTop(qreal y)

직사각형의 위쪽 가장자리를 지정된 유한 y 좌표로 설정합니다. 높이는 변경할 수 있지만 직사각형의 아래쪽 가장자리는 변경하지 않습니다.

setY()와 동일합니다.

top() 및 moveTop()도 참조하세요 .

[constexpr noexcept] void QRectF::setTopLeft(const QPointF &position)

직사각형의 왼쪽 상단 모서리를 지정된 position 으로 설정합니다. 크기는 변경할 수 있지만 직사각형의 오른쪽 하단 모서리는 변경하지 않습니다.

topLeft() 및 moveTopLeft()도 참조하세요 .

[constexpr noexcept] void QRectF::setTopRight(const QPointF &position)

직사각형의 오른쪽 상단 모서리를 지정된 position 으로 설정합니다. 크기는 변경할 수 있지만 직사각형의 왼쪽 하단 모서리는 변경하지 않습니다.

topRight() 및 moveTopRight()도 참조하세요 .

[constexpr noexcept] void QRectF::setWidth(qreal width)

직사각형의 너비를 주어진 유한값 width 으로 설정합니다. 오른쪽 가장자리는 변경되지만 왼쪽 가장자리는 변경되지 않습니다.

width() 및 setSize()도 참조하세요 .

[constexpr noexcept] void QRectF::setX(qreal x)

직사각형의 왼쪽 가장자리를 지정된 유한 x 좌표로 설정합니다. 너비는 변경할 수 있지만 직사각형의 오른쪽 가장자리는 변경하지 않습니다.

setLeft()와 동일합니다.

x(), setY() 및 setTopLeft()도 참조하세요 .

[constexpr noexcept] void QRectF::setY(qreal y)

직사각형의 위쪽 가장자리를 지정된 유한 y 좌표로 설정합니다. 높이는 변경할 수 있지만 직사각형의 아래쪽 가장자리는 변경하지 않습니다.

setTop()와 동일합니다.

y(), setX() 및 setTopLeft()도 참조하세요 .

[constexpr noexcept] QSizeF QRectF::size() const

직사각형의 크기를 반환합니다.

setSize(), width() 및 height()도 참조하세요 .

[noexcept] QRect QRectF::toAlignedRect() const

이 직사각형의 값에 따라 이 직사각형을 완전히 포함하는 가능한 가장 작은 정수 직사각형인 QRect 을 반환합니다.

toRect()도 참조하세요 .

[noexcept] CGRect QRectF::toCGRect() const

QRectF 에서 CGRect를 생성합니다.

fromCGRect()도 참조하세요 .

[since 6.5] emscripten::val QRectF::toDOMRect() const

이 객체를 DOMRect로 변환합니다 (https://www.w3.org/TR/geometry-1/).

이 함수는 Qt 6.5에 도입되었습니다.

fromDOMRect()도 참조하십시오 .

[constexpr noexcept] QRect QRectF::toRect() const

이 사각형의 값을 기반으로 QRect 를 반환합니다. 반환된 사각형의 좌표는 가장 가까운 정수로 반올림됩니다.

QRectF(), toAlignedRect() 및 QRect::toRectF()도 참조하세요 .

[constexpr noexcept] qreal QRectF::top() const

직사각형의 위쪽 가장자리의 y 좌표를 반환합니다. y ()에 해당합니다.

setTop(), topLeft() 및 topRight()도 참조하세요 .

[constexpr noexcept] QPointF QRectF::topLeft() const

직사각형의 왼쪽 상단 모서리 위치를 반환합니다.

setTopLeft(), top() 및 left()도 참조하세요 .

[constexpr noexcept] QPointF QRectF::topRight() const

직사각형의 오른쪽 상단 모서리 위치를 반환합니다.

setTopRight(), top() 및 right()도 참조하세요 .

[constexpr noexcept] void QRectF::translate(qreal dx, qreal dy)

현재 위치를 기준으로 직사각형 dx 을 x축을 따라, dy 을 y축을 따라 이동합니다. 양수 값은 직사각형을 오른쪽 및 아래쪽으로 이동합니다. 두 매개변수 모두 유한해야 합니다.

moveTopLeft(), moveTo() 및 translated()도 참조하세요 .

[constexpr noexcept] void QRectF::translate(const QPointF &offset)

이 함수는 오버로드된 함수입니다.

직사각형 offset.x()을 현재 위치를 기준으로 x축을 따라 이동하고 offset.y()을 y축을 따라 이동합니다.

[constexpr noexcept] QRectF QRectF::translated(qreal dx, qreal dy) const

현재 위치를 기준으로 x축을 따라 dx, y축을 따라 dy 변환된 직사각형의 복사본을 반환합니다. 양수 값은 직사각형을 오른쪽과 아래로 이동시킵니다. 두 매개변수 모두 유한해야 합니다.

translate()도 참조하세요 .

[constexpr noexcept] QRectF QRectF::translated(const QPointF &offset) const

이 함수는 오버로드된 함수입니다.

현재 위치를 기준으로 x축을 따라 offset.x(), y축을 따라 offset.y() 변환된 직사각형의 복사본을 반환합니다.

[constexpr noexcept] QRectF QRectF::transposed() const

너비와 높이가 교환된 직사각형의 복사본을 반환합니다:

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

QSizeF::transposed()도 참조하세요 .

[noexcept] QRectF QRectF::united(const QRectF &rectangle) const

이 사각형과 주어진 rectangle 의 경계 사각형을 반환합니다.

intersected()도 참조하세요 .

[constexpr noexcept] qreal QRectF::width() const

직사각형의 너비를 반환합니다.

setWidth(), height() 및 size()도 참조하세요 .

[constexpr noexcept] qreal QRectF::x() const

직사각형의 왼쪽 가장자리의 x 좌표를 반환합니다. left ()와 동일합니다.

setX(), y() 및 topLeft()도 참조하세요 .

[constexpr noexcept] qreal QRectF::y() const

직사각형의 위쪽 가장자리의 y 좌표를 반환합니다. top ()에 해당합니다.

setY(), x() 및 topLeft()도 참조하세요 .

[noexcept] QRectF QRectF::operator&(const QRectF &rectangle) const

이 사각형과 주어진 rectangle 의 교집합을 반환합니다. 교집합이 없으면 빈 사각형을 반환합니다.

operator&=() 및 intersected()도 참조하세요 .

[noexcept] QRectF &QRectF::operator&=(const QRectF &rectangle)

이 직사각형을 주어진 rectangle 과 교차시킵니다.

intersected() 및 operator&()도 참조하세요 .

[constexpr noexcept] QRectF &QRectF::operator+=(const QMarginsF &margins)

사각형에 margins 을 추가하여 사각형이 커집니다.

marginsAdded(), marginsRemoved() 및 operator-=()도 참조하세요 .

[constexpr noexcept] QRectF &QRectF::operator-=(const QMarginsF &margins)

margins 만큼 축소된 직사각형을 반환합니다.

marginsRemoved(), operator+=(), marginsAdded()도 참조하세요 .

[noexcept] QRectF QRectF::operator|(const QRectF &rectangle) const

이 사각형과 주어진 rectangle 의 경계 사각형을 반환합니다.

united() 및 operator|=()도 참조하세요 .

[noexcept] QRectF &QRectF::operator|=(const QRectF &rectangle)

이 직사각형을 주어진 rectangle 과 결합합니다.

united() 및 operator|()도 참조하세요 .

관련 비회원

[constexpr noexcept, since 6.8] bool qFuzzyCompare(const QRectF &lhs, const QRectF &rhs)

직사각형 lhs 이 직사각형 rhs 과 거의 같으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

이 함수는 Qt 6.8에 도입되었습니다.

[constexpr noexcept, since 6.8] bool qFuzzyIsNull(const QRectF &rect)

직사각형 rect 의 너비와 높이가 모두 0과 같으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

이 함수는 Qt 6.8에 도입되었습니다.

[constexpr noexcept] bool operator!=(const QRectF &lhs, const QRectF &rhs)

직사각형 lhsrhs 이 충분히 다르면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

경고: 이 함수는 엄격한 부등식을 검사하지 않고 퍼지 비교를 사용하여 직사각형의 좌표를 비교합니다.

[constexpr noexcept] QRectF operator+(const QMarginsF &lhs, const QRectF &rhs)

이 함수는 오버로드된 함수입니다.

rhs 여백만큼 커진 lhs 직사각형을 반환합니다.

[constexpr noexcept] QRectF operator+(const QRectF &lhs, const QMarginsF &rhs)

rhs 여백만큼 커진 lhs 직사각형을 반환합니다.

[constexpr noexcept] QRectF operator-(const QRectF &lhs, const QMarginsF &rhs)

rhs 여백만큼 축소된 lhs 직사각형을 반환합니다.

QDataStream &operator<<(QDataStream &stream, const QRectF &rectangle)

streamrectangle 을 쓰고 스트림에 대한 참조를 반환합니다.

Qt 데이터 유형 직렬화도참조하십시오 .

[constexpr noexcept] bool operator==(const QRectF &lhs, const QRectF &rhs)

직사각형 lhsrhs거의 같으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

경고: 이 함수는 엄격한 동일성을 검사하지 않고 대신 퍼지 비교를 사용하여 직사각형의 좌표를 비교합니다.

qFuzzyCompare도 참조하세요 .

QDataStream &operator>>(QDataStream &stream, QRectF &rectangle)

stream 에서 rectangle 을 읽고 스트림에 대한 참조를 반환합니다.

Qt 데이터 유형 직렬화도참조하십시오 .

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.