The QGraphicsPathItem class provides a path item that you can add to a QGraphicsScene . 更多...
| 頭: | #include <QGraphicsPathItem> |
| qmake: | QT += widgets |
| Since: | Qt 4.2 |
| 繼承: | QAbstractGraphicsShapeItem |
| enum | anonymous { Type } |
| QGraphicsPathItem (QGraphicsItem * parent = nullptr) | |
| QGraphicsPathItem (const QPainterPath & path , QGraphicsItem * parent = nullptr) | |
| virtual | ~QGraphicsPathItem () |
| QPainterPath | path () const |
| void | setPath (const QPainterPath & path ) |
| 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 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 ,和 圖形視圖框架 .
值的返迴是通過虛擬 type () 函數。
| 常量 | 值 | 描述 |
|---|---|---|
QGraphicsPathItem::Type
|
2
|
圖形路徑項 |
構造 QGraphicsPath。 parent 被傳遞給 QAbstractGraphicsShapeItem 的構造函數。
另請參閱 QGraphicsScene::addItem ().
構造 QGraphicsPath 項使用 path 作為默認路徑。 parent 被傳遞給 QAbstractGraphicsShapeItem 的構造函數。
另請參閱 QGraphicsScene::addItem ().
[虛擬]
QGraphicsPathItem::
~QGraphicsPathItem
()
銷毀 QGraphicsPathItem .
[override virtual]
QRectF
QGraphicsPathItem::
boundingRect
() const
重實現自 QGraphicsItem::boundingRect ().
[override virtual]
bool
QGraphicsPathItem::
contains
(const
QPointF
&
point
) const
重實現自 QGraphicsItem::contains ().
[override virtual]
bool
QGraphicsPathItem::
isObscuredBy
(const
QGraphicsItem
*
item
) const
重實現自 QAbstractGraphicsShapeItem::isObscuredBy ().
[override virtual]
QPainterPath
QGraphicsPathItem::
opaqueArea
() const
重實現自 QAbstractGraphicsShapeItem::opaqueArea ().
[override virtual]
void
QGraphicsPathItem::
paint
(
QPainter
*
painter
, const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
= nullptr)
重實現自 QGraphicsItem::paint ().
將項的路徑返迴作為 QPainterPath 。若未設置項,空 QPainterPath 被返迴。
另請參閱 setPath ().
將項的路徑設為給定 path .
另請參閱 path ().
[override virtual]
QPainterPath
QGraphicsPathItem::
shape
() const
重實現自 QGraphicsItem::shape ().
[override virtual]
int
QGraphicsPathItem::
type
() const
重實現自 QGraphicsItem::type ().