이 페이지에서

QGraphicsPolygonItem Class

QGraphicsPolygonItem 클래스는 다각형 항목을 제공하며, 이 항목을 QGraphicsScene 에 추가할 수 있습니다. 더 보기...

헤더: #include <QGraphicsPolygonItem>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
상속: QAbstractGraphicsShapeItem

공개 타입

enum { Type }

공개 함수

QGraphicsPolygonItem(QGraphicsItem *parent = nullptr)
QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent = nullptr)
virtual ~QGraphicsPolygonItem()
Qt::FillRule fillRule() const
QPolygonF polygon() const
void setFillRule(Qt::FillRule rule)
void setPolygon(const QPolygonF &polygon)

재구현된 공용 함수

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

상세 설명

항목의 다각형을 설정하려면 QGraphicsPolygonItem의 생성자에 QPolygonF 을 전달하거나, setPolygon() 함수를 호출하십시오. polygon() 함수는 현재 다각형을 반환합니다.

원점 근처에 그려진 다각형

QGraphicsPolygonItem은 다각형과 펜 너비를 사용하여 boundingRect(), shape() 및 contains()을 합리적으로 구현합니다. paint() 함수는 항목에 연결된 펜과 브러시를 사용하여 다각형을 그립니다. 이 펜과 브러시는 setPen() 및 setBrush() 함수를 호출하여 설정할 수 있습니다.

QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsTextItem, QGraphicsLineItem, QGraphicsPixmapItem 및 Graphics View Framework도참조하십시오 .

멤버 유형 문서

[anonymous] enum

가상 함수 ` type()`가 반환하는 값.

상수값설명
QGraphicsPolygonItem::Type5그래픽 다각형 항목

멤버 함수 문서

[explicit] QGraphicsPolygonItem::QGraphicsPolygonItem(QGraphicsItem *parent = nullptr)

QGraphicsPolygonItem을 생성합니다. ` parent `는 ` QAbstractGraphicsShapeItem`의 생성자에 전달됩니다.

QGraphicsScene::addItem()도 참조하십시오 .

[explicit] QGraphicsPolygonItem::QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent = nullptr)

polygon 를 기본 다각형으로 사용하여 QGraphicsPolygonItem을 생성합니다. parent 는 QAbstractGraphicsShapeItem 의 생성자에 전달됩니다.

QGraphicsScene::addItem()도 참조하십시오 .

[virtual noexcept] QGraphicsPolygonItem::~QGraphicsPolygonItem()

QGraphicsPolygonItem 를 삭제합니다.

[override virtual] QRectF QGraphicsPolygonItem::boundingRect() const

QGraphicsItem::boundingRect() const를 재구현합니다.

[override virtual] bool QGraphicsPolygonItem::contains(const QPointF &point) const

QGraphicsItem::contains(const QPointF &point) const를 재구현합니다.

Qt::FillRule QGraphicsPolygonItem::fillRule() const

다각형의 채우기 규칙을 반환합니다. 기본 채우기 규칙은 ‘ Qt::OddEvenFill ’입니다.

setFillRule(), QPainterPath::fillRule(), QPainter::drawPolygon()도 참조하십시오 .

[override virtual] bool QGraphicsPolygonItem::isObscuredBy(const QGraphicsItem *item) const

QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem *item) const를 재구현합니다.

[override virtual] QPainterPath QGraphicsPolygonItem::opaqueArea() const

QAbstractGraphicsShapeItem::opaqueArea() const를 재구현합니다.

[override virtual] void QGraphicsPolygonItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)

QGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)를 재구현합니다.

QPolygonF QGraphicsPolygonItem::polygon() const

항목의 다각형을 반환하거나, 다각형이 설정되어 있지 않은 경우 빈 다각형을 반환합니다.

setPolygon()도 참조하십시오 .

void QGraphicsPolygonItem::setFillRule(Qt::FillRule rule)

다각형의 채우기 규칙을 ‘ rule ’로 설정합니다. 기본 채우기 규칙은 ‘ Qt::OddEvenFill ’입니다.

fillRule(), QPainterPath::fillRule(), QPainter::drawPolygon()도 참조하십시오 .

void QGraphicsPolygonItem::setPolygon(const QPolygonF &polygon)

항목의 다각형을 지정된 polygon 로 설정합니다.

polygon()도 참조하십시오 .

[override virtual] QPainterPath QGraphicsPolygonItem::shape() const

QGraphicsItem::shape() const를 재구현합니다.

[override virtual] int QGraphicsPolygonItem::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.