QGraphicsPolygonItem 類

QGraphicsPolygonItem 類提供的多邊形項可以被添加到 QGraphicsScene . 更多...

頭: #include <QGraphicsPolygonItem>
qmake: QT += widgets
Since: Qt 4.2
繼承: QAbstractGraphicsShapeItem

該類在 Qt 4.2 引入。

公共類型

enum anonymous { Type }

公共函數

QGraphicsPolygonItem (const QPolygonF & polygon , QGraphicsItem * parent = nullptr)
QGraphicsPolygonItem (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

詳細描述

要設置項的多邊形,傳遞 QPolygonF 到 QGraphicsPolygonItem 的構造函數,或調用 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 (const QPolygonF & polygon , QGraphicsItem * parent = nullptr)

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

另請參閱 QGraphicsScene::addItem ().

QGraphicsPolygonItem:: QGraphicsPolygonItem ( QGraphicsItem * parent = nullptr)

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

另請參閱 QGraphicsScene::addItem ().

[虛擬] 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

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 () const.

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

重實現: QGraphicsItem::type () const.