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 anonymous { 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그래픽 보기 프레임워크도참조하세요 .

회원 유형 문서

enum QGraphicsPolygonItem::anonymous

가상 type() 함수가 반환하는 값입니다.

상수Value설명
QGraphicsPolygonItem::Type5그래픽 폴리곤 항목

멤버 함수 문서

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

QAbstractGraphicsShapeItem 의 생성자에 parent 을 전달합니다.

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

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

polygon 을 기본 다각형으로 하여 QGraphicsPolygonItem을 구축합니다. parentQAbstractGraphicsShapeItem 의 생성자에게 전달됩니다.

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 *페인터, const Q스타일옵션그래픽아이템 *옵션, Q위젯 *위젯).

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.

© 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.