QLine Class

QLine 클래스는 정수 정밀도를 사용하는 2차원 벡터를 제공합니다. 더 보기...

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

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

이 클래스는 QLineF동등합니다.

공용 함수

QLine()
QLine(const QPoint &p1, const QPoint &p2)
QLine(int x1, int y1, int x2, int y2)
QPoint p1() const
QPoint p2() const
int x1() const
int x2() const
int y1() const
int y2() const
QPoint center() const
int dx() const
int dy() const
bool isNull() const
void setP1(const QPoint &p1)
void setP2(const QPoint &p2)
void setLine(int x1, int y1, int x2, int y2)
void setPoints(const QPoint &p1, const QPoint &p2)
(since 6.4) QLineF toLineF() const
void translate(const QPoint &offset)
void translate(int dx, int dy)
QLine translated(const QPoint &offset) const
QLine translated(int dx, int dy) const
bool operator!=(const QLine &lhs, const QLine &rhs)
QDataStream &operator<<(QDataStream &stream, const QLine &line)
bool operator==(const QLine &lhs, const QLine &rhs)
QDataStream &operator>>(QDataStream &stream, QLine &line)

상세 설명

QLine은 2차원 서페이스의 유한 길이 선(또는 선분)을 나타냅니다. 선의 시작점과 끝점은 좌표의 정수점 정확도를 사용하여 지정됩니다. QLineF 생성자를 사용하여 부동 소수점 복사본을 검색합니다.

선의 시작점과 끝점의 위치는 p1(), x1(), y1(), p2(), x2() 및 y2() 함수를 사용하여 검색할 수 있습니다. dx () 및 dy() 함수는 선의 가로 및 세로 구성 요소를 반환합니다. isNull ()를 사용하여 QLine이 유효한 줄을 나타내는지 아니면 null 줄을 나타내는지 확인합니다.

마지막으로 translate() 함수를 사용하여 줄을 지정된 오프셋만큼 변환할 수 있습니다.

QLineF, QPolygon, QRect참조하세요 .

멤버 함수 문서

[constexpr] QLine::QLine()

널 라인을 생성합니다.

[constexpr] QLine::QLine(const QPoint &p1, const QPoint &p2)

p1p2 사이의 선을 나타내는 선 객체를 생성합니다.

[constexpr] QLine::QLine(int x1, int y1, int x2, int y2)

(x1, y1)와 (x2, y2) 사이의 선을 나타내는 선 객체를 생성합니다.

[constexpr] QPoint QLine::p1() const

선의 시작점을 반환합니다.

setP1(), x1(), y1() 및 p2()도 참조하세요 .

[constexpr] QPoint QLine::p2() const

선의 끝점을 반환합니다.

setP2(), x2(), y2() 및 p1()도 참조하세요 .

[constexpr] int QLine::x1() const

선의 시작점의 x 좌표를 반환합니다.

p1()도 참조하세요 .

[constexpr] int QLine::x2() const

선의 끝점의 x 좌표를 반환합니다.

p2()도 참조하세요 .

[constexpr] int QLine::y1() const

선의 시작점의 y 좌표를 반환합니다.

p1()도 참조하세요 .

[constexpr] int QLine::y2() const

선의 끝점의 y 좌표를 반환합니다.

p2()도 참조하세요 .

[constexpr] QPoint QLine::center() const

이 선의 중심점을 반환합니다. 이는 (p1() + p2()) / 2와 같지만 오버플로되지 않는다는 점을 제외하면 동일합니다.

[constexpr] int QLine::dx() const

선 벡터의 가로 성분을 반환합니다.

dy()도 참조하세요 .

[constexpr] int QLine::dy() const

선 벡터의 수직 성분을 반환합니다.

dx()도 참조하세요 .

[constexpr] bool QLine::isNull() const

줄에 시작점과 끝점이 구분되지 않으면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

void QLine::setP1(const QPoint &p1)

이 줄의 시작점을 p1 로 설정합니다.

setP2() 및 p1()도 참조하세요 .

void QLine::setP2(const QPoint &p2)

이 줄의 끝점을 p2 으로 설정합니다.

setP1() 및 p2()도 참조하세요 .

void QLine::setLine(int x1, int y1, int x2, int y2)

이 줄을 x1, y1 에서 시작하고 x2, y2 에서 끝내도록 설정합니다.

setP1(), setP2(), p1() 및 p2()도 참조하세요 .

void QLine::setPoints(const QPoint &p1, const QPoint &p2)

이 줄의 시작점을 p1 으로, 끝점을 p2 으로 설정합니다.

setP1(), setP2(), p1() 및 p2()도 참조하세요 .

[constexpr noexcept, since 6.4] QLineF QLine::toLineF() const

이 선을 부동 소수점 정확도를 가진 선으로 반환합니다.

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

QLineF::toLine()도 참조하십시오 .

void QLine::translate(const QPoint &offset)

이 줄을 주어진 offset 으로 번역합니다.

void QLine::translate(int dx, int dy)

이것은 과부하된 함수입니다.

이 줄을 dxdy 에 지정된 거리만큼 변환합니다.

[constexpr] QLine QLine::translated(const QPoint &offset) const

주어진 offset 으로 번역된 이 줄을 반환합니다.

[constexpr] QLine QLine::translated(int dx, int dy) const

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

dxdy 에서 지정한 거리만큼 변환된 이 줄을 반환합니다.

관련 비회원

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

lhs 줄이 rhs 줄과 같지 않으면 true 을 반환합니다.

시작점이나 끝점이 다르거나 점의 내부 순서가 다른 경우 한 줄이 다른 줄과 다릅니다.

QDataStream &operator<<(QDataStream &stream, const QLine &line)

주어진 line 을 주어진 stream 에 쓰고 스트림에 대한 참조를 반환합니다.

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

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

lhs 줄이 rhs 줄과 같으면 true 을 반환합니다.

시작점과 끝점이 동일하고 점의 내부 순서가 같으면 한 줄은 다른 줄과 동일합니다.

QDataStream &operator>>(QDataStream &stream, QLine &line)

주어진 stream 에서 주어진 line 으로 한 줄을 읽고 스트림에 대한 참조를 반환합니다.

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.