QGraphicsPathItem 類

The QGraphicsPathItem class provides a path item that you can add to a QGraphicsScene . 更多...

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

公共函數

QGraphicsPathItem (QGraphicsItem * parent = Q_NULLPTR)
QGraphicsPathItem (const QPainterPath & path , QGraphicsItem * parent = Q_NULLPTR)
~QGraphicsPathItem ()
QPainterPath path () const
void setPath (const QPainterPath & path )

重實現公共函數

virtual QRectF boundingRect () const
virtual bool contains (const QPointF & point ) const
virtual bool isObscuredBy (const QGraphicsItem * item ) const
virtual QPainterPath opaqueArea () const
virtual void paint (QPainter * painter , const QStyleOptionGraphicsItem * option , QWidget * widget = Q_NULLPTR)
virtual QPainterPath shape () const
virtual int type () const

額外繼承成員

詳細描述

The QGraphicsPathItem class provides a path item that you can add to a QGraphicsScene .

要設置項的路徑,傳遞 QPainterPath to QGraphicsPathItem 's constructor, or call the setPath () 函數。 path () 函數返迴當前路徑。

QGraphicsPathItem uses the path to provide a reasonable implementation of boundingRect (), shape (),和 contains ()。 paint () 函數使用項關聯的鋼筆和筆刷繪製路徑,可以設置通過調用 setPen () 和 setBrush () 函數。

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

成員函數文檔編製

QGraphicsPathItem:: QGraphicsPathItem ( QGraphicsItem * parent = Q_NULLPTR)

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

另請參閱 QGraphicsScene::addItem ().

QGraphicsPathItem:: QGraphicsPathItem (const QPainterPath & path , QGraphicsItem * parent = Q_NULLPTR)

構造 QGraphicsPath 項使用 path 作為默認路徑。 parent 被傳遞給 QAbstractGraphicsShapeItem 的構造函數。

另請參閱 QGraphicsScene::addItem ().

QGraphicsPathItem:: ~QGraphicsPathItem ()

銷毀 QGraphicsPathItem .

[虛擬] QRectF QGraphicsPathItem:: boundingRect () const

重實現自 QGraphicsItem::boundingRect ().

[虛擬] bool QGraphicsPathItem:: contains (const QPointF & point ) const

重實現自 QGraphicsItem::contains ().

[虛擬] bool QGraphicsPathItem:: isObscuredBy (const QGraphicsItem * item ) const

重實現自 QGraphicsItem::isObscuredBy ().

[虛擬] QPainterPath QGraphicsPathItem:: opaqueArea () const

重實現自 QGraphicsItem::opaqueArea ().

[虛擬] void QGraphicsPathItem:: paint ( QPainter * painter , const QStyleOptionGraphicsItem * option , QWidget * widget = Q_NULLPTR)

重實現自 QGraphicsItem::paint ().

QPainterPath QGraphicsPathItem:: path () const

將項的路徑返迴作為 QPainterPath 。若未設置項,空 QPainterPath 被返迴。

另請參閱 setPath ().

void QGraphicsPathItem:: setPath (const QPainterPath & path )

將項的路徑設為給定 path .

另請參閱 path ().

[虛擬] QPainterPath QGraphicsPathItem:: shape () const

重實現自 QGraphicsItem::shape ().

[虛擬] int QGraphicsPathItem:: type () const

重實現自 QGraphicsItem::type ().