QGraphicsPathItem 类

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

额外继承成员

详细描述

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 .

[virtual] QRectF QGraphicsPathItem:: boundingRect () const

重实现自 QGraphicsItem::boundingRect ().

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

重实现自 QGraphicsItem::contains ().

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

重实现自 QGraphicsItem::isObscuredBy ().

[virtual] QPainterPath QGraphicsPathItem:: opaqueArea () const

重实现自 QGraphicsItem::opaqueArea ().

[virtual] 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 ().

[virtual] QPainterPath QGraphicsPathItem:: shape () const

重实现自 QGraphicsItem::shape ().

[virtual] int QGraphicsPathItem:: type () const

重实现自 QGraphicsItem::type ().