QGraphicsPolygonItem Class Reference

[ QtGui module]

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

继承 QAbstractGraphicsShapeItem .

方法


详细描述

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

To set the item's polygon, pass a QPolygonF to QGraphicsPolygonItem's constructor, or call the setPolygon () 函数。 polygon () function returns the current 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 () 函数。


方法文档编制

QGraphicsPolygonItem.__init__ ( self , QGraphicsItem   parent  = None, QGraphicsScene   scene  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

scene argument, if not None, causes self to be owned by Qt instead of PyQt.

构造 QGraphicsPolygonItem . parent 会被传递给 QAbstractGraphicsShapeItem 's 构造函数。

另请参阅 QGraphicsScene.addItem ().

QGraphicsPolygonItem.__init__ ( self , QPolygonF   polygon , QGraphicsItem   parent  = None, QGraphicsScene   scene  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

scene argument, if not None, causes self to be owned by Qt instead of PyQt.

构造 QGraphicsPolygonItem with polygon as the default polygon. parent 会被传递给 QAbstractGraphicsShapeItem 's 构造函数。

另请参阅 QGraphicsScene.addItem ().

QRectF QGraphicsPolygonItem.boundingRect ( self )

重实现自 QGraphicsItem.boundingRect ().

bool QGraphicsPolygonItem.contains ( self , QPointF   point )

重实现自 QGraphicsItem.contains ().

Qt.FillRule QGraphicsPolygonItem.fillRule ( self )

Returns the fill rule of the polygon. The default fill rule is Qt.OddEvenFill .

另请参阅 setFillRule (), QPainterPath.fillRule (),和 QPainter.drawPolygon ().

bool QGraphicsPolygonItem.isObscuredBy ( self , QGraphicsItem   item )

重实现自 QGraphicsItem.isObscuredBy ().

QPainterPath QGraphicsPolygonItem.opaqueArea ( self )

重实现自 QGraphicsItem.opaqueArea ().

QGraphicsPolygonItem.paint ( self , QPainter   painter , QStyleOptionGraphicsItem   option , QWidget   widget  = None)

重实现自 QGraphicsItem.paint ().

QPolygonF QGraphicsPolygonItem.polygon ( self )

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

另请参阅 setPolygon ().

QGraphicsPolygonItem.setFillRule ( self , Qt.FillRule   rule )

Sets the fill rule of the polygon to rule 。默认 fill rule is Qt.OddEvenFill .

另请参阅 fillRule (), QPainterPath.fillRule (),和 QPainter.drawPolygon ().

QGraphicsPolygonItem.setPolygon ( self , QPolygonF   polygon )

Sets the item's polygon to be the given polygon .

另请参阅 polygon ().

QPainterPath QGraphicsPolygonItem.shape ( self )

重实现自 QGraphicsItem.shape ().

int QGraphicsPolygonItem.type ( self )

重实现自 QGraphicsItem.type ().