QPointF Class
QPointF 클래스는 부동 소수점 정밀도를 사용하여 평면상의 점을 정의합니다. 더 보기...
| 헤더: | #include <QPointF> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
- 상속된 멤버를 포함한 모든 멤버 목록
- QPointF는 Painting 클래스의 일부입니다.
참고: 이 클래스의 모든 함수는 재진입 가능합니다.
QPointF 비교
| 범주 | 비교 가능한 유형 |
|---|---|
| 동등성 | QPointF |
| 동등성 | QPoint. |
공개 함수
| QPointF() | |
| QPointF(const QPoint &point) | |
| QPointF(qreal xpos, qreal ypos) | |
| bool | isNull() const |
| qreal | manhattanLength() const |
| qreal & | rx() |
| qreal & | ry() |
| void | setX(qreal x) |
| void | setY(qreal y) |
| CGPoint | toCGPoint() const |
| QPoint | toPoint() const |
| QPointF | transposed() const |
| qreal | x() const |
| qreal | y() const |
| QPointF & | operator*=(qreal factor) |
| QPointF & | operator+=(const QPointF &point) |
| QPointF & | operator-=(const QPointF &point) |
| QPointF & | operator/=(qreal divisor) |
정적 공용 멤버
| qreal | dotProduct(const QPointF &p1, const QPointF &p2) |
| QPointF | fromCGPoint(CGPoint point) |
관련 비회원
(since 6.8) bool | qFuzzyCompare(const QPointF &p1, const QPointF &p2) |
(since 6.8) bool | qFuzzyIsNull(const QPointF &point) |
| bool | operator!=(const QPointF &lhs, const QPointF &rhs) |
| QPointF | operator*(const QPointF &point, qreal factor) |
| QPointF | operator*(qreal factor, const QPointF &point) |
| QPointF | operator+(const QPointF &point) |
| QPointF | operator+(const QPointF &p1, const QPointF &p2) |
| QPointF | operator-(const QPointF &p1, const QPointF &p2) |
| QPointF | operator-(const QPointF &point) |
| QPointF | operator/(const QPointF &point, qreal divisor) |
| QDataStream & | operator<<(QDataStream &stream, const QPointF &point) |
| bool | operator==(const QPointF &lhs, const QPointF &rhs) |
| QDataStream & | operator>>(QDataStream &stream, QPointF &point) |
상세 설명
점은 x 좌표와 y 좌표로 지정되며, 이 좌표들은 ` x()` 및 ` y()` 함수를 사용하여 접근할 수 있습니다. 점의 좌표는 정확성을 위해 유한 부동 소수점 숫자로 지정됩니다. isNull() 함수는 x와 y가 모두 0.0으로 설정된 경우 true 를 반환합니다. 좌표는 setX() 및 setY() 함수를 사용하여 설정(또는 변경)할 수 있으며, 또는 좌표에 대한 참조를 반환하여(직접 조작이 가능하도록) rx() 및 ry() 함수를 사용할 수도 있습니다.
점 p가 주어졌을 때, 다음 문장들은 모두 동등합니다:
QPointF 객체는 벡터로도 사용할 수 있습니다. 덧셈과 뺄셈은 벡터와 마찬가지로 정의됩니다(각 성분이 별도로 더해집니다). 또한 QPointF 객체는 int 또는 qreal 객체로 나눌 수 있고, 이들과 곱할 수도 있습니다.
또한, QPointF 클래스는 QPoint 객체를 QPointF 객체로 변환하는 생성자와, 이 점의 QPoint 복사본을 반환하는 해당 toPoint() 함수를 제공합니다. 마지막으로, QPointF 객체는 스트리밍이 가능하며 비교도 가능합니다.
멤버 함수 문서
[constexpr noexcept] QPointF::QPointF()
좌표가 (0.0, 0.0)인 원점을 생성합니다.
isNull()도 참조하십시오 .
[constexpr noexcept] QPointF::QPointF(const QPoint &point)
지정된 ` point`의 복사본을 생성합니다.
toPoint() 및 QPoint::toPointF()도 참조하십시오 .
[constexpr noexcept] QPointF::QPointF(qreal xpos, qreal ypos)
주어진 좌표(xpos, ypos)를 가진 점을 생성합니다.
[static constexpr] qreal QPointF::dotProduct(const QPointF &p1, const QPointF &p2)
QPointF p( 3.1, 7.1);
QPointF q(-1.0, 4.1);
qreal dotProduct = QPointF::dotProduct(p, q); // dotProduct becomes 26.01p1 와 p2 의 내적을 반환합니다.
[static noexcept] QPointF QPointF::fromCGPoint(CGPoint point)
CGPoint point 를 사용하여 QRectF 를 생성합니다.
toCGPoint()도 참조하십시오 .
[noexcept] bool QPointF::isNull() const
x 및 y 좌표가 모두 0.0으로 설정된 경우(부호는 무시함) ` true `을 반환하고, 그렇지 않은 경우 ` false`을 반환합니다.
[constexpr] qreal QPointF::manhattanLength() const
x()와 y()의 절댓값의 합을 반환하며, 이는 전통적으로 원점에서 해당 점까지의 벡터의 “맨해튼 거리”로 알려져 있습니다.
QPoint::manhattanLength()도 참조하십시오 .
[constexpr noexcept] qreal &QPointF::rx()
이 점의 x 좌표에 대한 참조를 반환합니다.
참조를 사용하면 x를 직접 조작할 수 있습니다. 예를 들어:
QPointF p(1.1, 2.5);
p.rx()--; // p becomes (0.1, 2.5)[constexpr noexcept] qreal &QPointF::ry()
이 점의 y 좌표에 대한 참조를 반환합니다.
참조를 사용하면 y를 직접 조작할 수 있습니다. 예를 들어:
QPointF p(1.1, 2.5);
p.ry()++; // p becomes (1.1, 3.5)[constexpr noexcept] void QPointF::setX(qreal x)
이 점의 x 좌표를 지정된 유한한 x 좌표로 설정합니다.
[constexpr noexcept] void QPointF::setY(qreal y)
이 점의 y 좌표를 주어진 유한한 y 좌표로 설정합니다.
[noexcept] CGPoint QPointF::toCGPoint() const
QPointF 에서 CGPoint를 생성합니다.
fromCGPoint()도 참조하십시오 .
[constexpr] QPoint QPointF::toPoint() const
이 점의 좌표를 가장 가까운 정수로 반올림하고, 반올림된 좌표를 가진 ` QPoint ` 객체를 반환합니다.
QPointF() 및 QPoint::toPointF()도 참조하십시오 .
[constexpr noexcept] QPointF QPointF::transposed() const
x와 y 좌표가 바뀐 점을 반환합니다:
QPointF{1.0, 2.0}.transposed() // {2.0, 1.0}x(), y(), setX(), setY()도 참조하십시오 .
[constexpr noexcept] qreal QPointF::x() const
이 점의 x 좌표를 반환합니다.
[constexpr noexcept] qreal QPointF::y() const
이 점의 y 좌표를 반환합니다.
[constexpr] QPointF &QPointF::operator*=(qreal factor)
이 점의 좌표에 주어진 유한한 factor 를 곱한 후, 이 점에 대한 참조를 반환합니다. 예를 들어:
QPointF p(-1.1, 4.1);
p *= 2.5; // p becomes (-2.75, 10.25)operator/=()도 참조하십시오 .
[constexpr] QPointF &QPointF::operator+=(const QPointF &point)
지정된 point 를 이 점에 더하고, 이 점에 대한 참조를 반환합니다. 예:
operator-=()도 참조하십시오 .
[constexpr] QPointF &QPointF::operator-=(const QPointF &point)
지정된 좌표 point 를 이 지점에서 빼고, 이 지점에 대한 참조를 반환합니다. 예:
operator+=()도 참조하십시오 .
[constexpr] QPointF &QPointF::operator/=(qreal divisor)
x와 y를 모두 주어진 divisor 로 나눈 후, 이 점에 대한 참조를 반환합니다. 예:
QPointF p(-2.75, 10.25);
p /= 2.5; // p becomes (-1.1, 4.1)divisor 는 0이나 NaN이어서는 안 됩니다.
operator*=()도 참조하십시오 .
관련 비멤버 함수
[constexpr noexcept, since 6.8] bool qFuzzyCompare(const QPointF &p1, const QPointF &p2)
p1 가 p2 와 대략적으로 같을 경우 true 를 반환하고, 그렇지 않은 경우 false 를 반환합니다.
이 함수는 Qt 6.8에서 도입되었습니다.
qFuzzyIsNull도 참조하십시오 .
[constexpr noexcept, since 6.8] bool qFuzzyIsNull(const QPointF &point)
point 가 점 (0.0, 0.0) 과 대략적으로 같을 경우, true 를 반환합니다.
이 함수는 Qt 6.8에서 도입되었습니다.
qFuzzyCompare도 참조하십시오 .
[constexpr noexcept] bool operator!=(const QPointF &lhs, const QPointF &rhs)
lhs 가 rhs 와 충분히 다른 경우 true 를 반환하고, 그렇지 않은 경우 false 를 반환합니다.
경고: 이 함수는 엄격한 부등식을 확인하지 않으며, 대신 점들의 좌표를 비교할 때 퍼지 비교를 사용합니다.
qFuzzyCompare도 참조하십시오 .
[constexpr] QPointF operator*(const QPointF &point, qreal factor)
주어진 point 의 복사본을, 주어진 유한 factor 를 곱한 값으로 반환합니다.
QPointF::operator*=()도 참조하십시오 .
[constexpr] QPointF operator*(qreal factor, const QPointF &point)
주어진 point 의 복사본에 주어진 유한한 factor 를 곱한 값을 반환합니다.
이 함수는 오버로드된 함수입니다.
[constexpr] QPointF operator+(const QPointF &point)
point 를 변경하지 않은 채로 반환합니다.
[constexpr] QPointF operator+(const QPointF &p1, const QPointF &p2)
주어진 점들인 p1 및 p2 의 합을 나타내는 QPointF 객체를 반환합니다. 각 성분은 별도로 더해집니다.
QPointF::operator+=()도 참조하십시오 .
[constexpr] QPointF operator-(const QPointF &p1, const QPointF &p2)
p2 를 p1 에서 뺀 값으로 구성된 ` QPointF ` 객체를 반환합니다. 각 성분은 별도로 뺍니다.
QPointF::operator-=()도 참조하십시오 .
[constexpr] QPointF operator-(const QPointF &point)
주어진 ` point`의 각 성분의 부호를 반전시켜 생성된 ` QPointF ` 객체를 반환합니다.
QPointF(0,0) - point 와 동일합니다.
이 함수는 오버로드된 함수입니다.
[constexpr] QPointF operator/(const QPointF &point, qreal divisor)
주어진 ` point `의 각 성분을 주어진 ` divisor`로 나눈 결과로 구성된 ` QPointF ` 객체를 반환합니다.
divisor 는 0이나 NaN이어서는 안 됩니다.
QPointF::operator/=()도 참조하십시오 .
QDataStream &operator<<(QDataStream &stream, const QPointF &point)
지정된 ` point `를 지정된 ` stream `에 기록하고, 해당 스트림에 대한 참조를 반환합니다.
Qt 데이터 유형의 직렬화도 참조하십시오 .
[constexpr noexcept] bool operator==(const QPointF &lhs, const QPointF &rhs)
lhs 가 rhs 와 대략적으로 같으면 true 를 반환하고, 그렇지 않으면 false 를 반환합니다.
경고: 이 함수는 엄격한 등가성을 확인하지 않으며, 대신 점들의 좌표를 비교할 때 퍼지 비교를 사용합니다.
qFuzzyCompare도 참조하십시오 .
QDataStream &operator>>(QDataStream &stream, QPointF &point)
지정된 ` stream `에서 지정한 ` point `으로 한 점을 읽어들이고, 해당 스트림에 대한 참조를 반환합니다.
Qt 데이터 유형 직렬화항목도 참조하십시오 .
© 2026 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.