QGraphicsLineItem Class
QGraphicsLineItem 클래스는 QGraphicsScene 에 추가할 수 있는 선 항목을 제공합니다. 더 보기...
| 헤더: | #include <QGraphicsLineItem> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| 상속: | QGraphicsItem |
공개 타입
| enum { Type } |
공개 함수
| QGraphicsLineItem(QGraphicsItem *parent = nullptr) | |
| QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = nullptr) | |
| QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = nullptr) | |
| virtual | ~QGraphicsLineItem() |
| QLineF | line() const |
| QPen | pen() const |
| void | setLine(const QLineF &line) |
| void | setLine(qreal x1, qreal y1, qreal x2, qreal y2) |
| void | setPen(const QPen &pen) |
재구현된 공용 함수
| virtual QRectF | boundingRect() const override |
| virtual bool | contains(const QPointF &point) const override |
| virtual bool | isObscuredBy(const QGraphicsItem *item) const override |
| virtual QPainterPath | opaqueArea() const override |
| virtual void | paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override |
| virtual QPainterPath | shape() const override |
| virtual int | type() const override |
상세 설명
항목의 선을 설정하려면 QGraphicsLineItem의 생성자에 ` QLineF `을 전달하거나 ` setLine()` 함수를 호출하십시오. ` line()` 함수는 현재 선을 반환합니다. 기본적으로 선은 너비 0의 검은색이지만, ` setPen()`를 호출하여 이를 변경할 수 있습니다.

QGraphicsLineItem은 선과 펜 너비를 사용하여 boundingRect(), shape() 및 contains() 함수를 적절하게 구현합니다. paint() 함수는 항목에 연결된 펜을 사용하여 선을 그립니다.
QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsTextItem, QGraphicsPolygonItem, QGraphicsPixmapItem 및 Graphics View Framework도참조하십시오 .
멤버 함수 문서
[explicit] QGraphicsLineItem::QGraphicsLineItem(QGraphicsItem *parent = nullptr)
QGraphicsLineItem 객체를 생성합니다. ` parent `는 ` QGraphicsItem`의 생성자에 전달됩니다.
QGraphicsScene::addItem()도 참조하십시오 .
[explicit] QGraphicsLineItem::QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = nullptr)
line 를 기본 선으로 사용하여 QGraphicsLineItem을 생성합니다. parent 는 QGraphicsItem 의 생성자에 전달됩니다.
QGraphicsScene::addItem()도 참조하십시오 .
[explicit] QGraphicsLineItem::QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = nullptr)
(x1, y1)과 (x2, y2) 사이의 선을 기본 선으로 사용하여 QGraphicsLineItem을 생성합니다. ` parent `는 ` QGraphicsItem`의 생성자에 전달됩니다.
QGraphicsScene::addItem()도 참조하십시오 .
[virtual noexcept] QGraphicsLineItem::~QGraphicsLineItem()
QGraphicsLineItem 를 삭제합니다.
[override virtual] QRectF QGraphicsLineItem::boundingRect() const
QGraphicsItem::boundingRect() const를 재구현합니다.
[override virtual] bool QGraphicsLineItem::contains(const QPointF &point) const
QGraphicsItem::contains(const QPointF &point) const를 재구현합니다.
[override virtual] bool QGraphicsLineItem::isObscuredBy(const QGraphicsItem *item) const
QGraphicsItem::isObscuredBy(const QGraphicsItem *item) const를 재구현합니다.
QLineF QGraphicsLineItem::line() const
항목의 줄을 반환하거나, 줄이 설정되지 않은 경우 null 줄을 반환합니다.
setLine()도 참조하십시오 .
[override virtual] QPainterPath QGraphicsLineItem::opaqueArea() const
QGraphicsItem::opaqueArea() const를 재구현합니다.
[override virtual] void QGraphicsLineItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)
QGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)를 재구현합니다.
QPen QGraphicsLineItem::pen() const
항목의 펜을 반환하며, 펜이 설정되지 않은 경우에는 너비가 0인 검은색 실선 펜을 반환합니다.
setPen()도 참조하십시오 .
void QGraphicsLineItem::setLine(const QLineF &line)
항목의 선을 지정된 line 로 설정합니다.
line()도 참조하십시오 .
void QGraphicsLineItem::setLine(qreal x1, qreal y1, qreal x2, qreal y2)
항목의 선을 (x1, y1)과 (x2, y2) 사이의 선으로 설정합니다.
이는 setLine(QLineF(x1, y1, x2, y2)) 를 호출하는 것과 동일합니다.
이는 오버로드된 함수입니다.
void QGraphicsLineItem::setPen(const QPen &pen)
항목의 펜을 pen 로 설정합니다. 펜이 설정되지 않은 경우, 선은 너비 0의 검은색 실선 펜으로 그려집니다.
pen()도 참조하십시오 .
[override virtual] QPainterPath QGraphicsLineItem::shape() const
QGraphicsItem::shape() const를 재구현합니다.
[override virtual] int QGraphicsLineItem::type() const
QGraphicsItem::type() const를 재구현합니다.
© 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.