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 | anonymous { 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 및 그래픽 보기 프레임워크도참조하세요 .
회원 유형 문서
enum QGraphicsLineItem::anonymous
가상 type() 함수가 반환하는 값입니다.
상수 | Value | 설명 |
---|---|---|
QGraphicsLineItem::Type | 6 | 그래픽 라인 항목 |
멤버 함수 문서
[explicit]
QGraphicsLineItem::QGraphicsLineItem(QGraphicsItem *parent = nullptr)
QGraphicsItem 의 생성자에 parent 을 전달합니다.
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 *페인터, const Q스타일옵션그래픽아이템 *옵션, Q위젯 *위젯).
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.
© 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.