QGraphicsPolygonItem 類

The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene . 更多...

頭: #include <QGraphicsPolygonItem>
qmake: QT += widgets
Since: Qt 4.2
繼承: 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

額外繼承成員

詳細描述

The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene .

要設置項的多邊形,傳遞 QPolygonF to QGraphicsPolygonItem 's constructor, or call the setPolygon () 函數。 polygon () 函數返迴當前多邊形。

QGraphicsPolygonItem uses the polygon and the pen width to provide a reasonable implementation of boundingRect (), shape (),和 contains ()。 paint () function draws the polygon using the item's associated pen and brush, which you can set by calling the setPen () 和 setBrush () 函數。

另請參閱 QGraphicsPathItem , QGraphicsRectItem , QGraphicsEllipseItem , QGraphicsTextItem , QGraphicsLineItem , QGraphicsPixmapItem ,和 圖形視圖框架 .

成員類型文檔編製

enum QGraphicsPolygonItem:: anonymous

值的返迴是通過虛擬 type () 函數。

常量 描述
QGraphicsPolygonItem::Type 5 A graphics polygon item

成員函數文檔編製

QGraphicsPolygonItem:: QGraphicsPolygonItem ( QGraphicsItem * parent = nullptr)

構造 QGraphicsPolygonItem . parent 被傳遞給 QAbstractGraphicsShapeItem 的構造函數。

另請參閱 QGraphicsScene::addItem ().

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

構造 QGraphicsPolygonItem with polygon 作為默認多邊形。 parent 被傳遞給 QAbstractGraphicsShapeItem 的構造函數。

另請參閱 QGraphicsScene::addItem ().

[虛擬] QGraphicsPolygonItem:: ~QGraphicsPolygonItem ()

銷毀 QGraphicsPolygonItem .

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

重實現自 QGraphicsItem::boundingRect ().

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

重實現自 QGraphicsItem::contains ().

Qt::FillRule QGraphicsPolygonItem:: fillRule () const

返迴多邊形填充規則。默認填充規則為 Qt::OddEvenFill .

另請參閱 setFillRule (), QPainterPath::fillRule (),和 QPainter::drawPolygon ().

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

重實現自 QAbstractGraphicsShapeItem::isObscuredBy ().

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

重實現自 QAbstractGraphicsShapeItem::opaqueArea ().

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

重實現自 QGraphicsItem::paint ().

QPolygonF QGraphicsPolygonItem:: polygon () const

Returns the item's polygon, or an empty polygon if no polygon has been set.

另請參閱 setPolygon ().

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

Sets the fill rule of the polygon to rule . The default fill rule is Qt::OddEvenFill .

另請參閱 fillRule (), QPainterPath::fillRule (),和 QPainter::drawPolygon ().

void QGraphicsPolygonItem:: setPolygon (const QPolygonF & polygon )

將項的多邊形設為給定 polygon .

另請參閱 polygon ().

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

重實現自 QGraphicsItem::shape ().

[override virtual] int QGraphicsPolygonItem:: type () const

重實現自 QGraphicsItem::type ().