QGraphicsLineItem Class Reference

[ QtGui module]

The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene . 更多...

继承 QGraphicsItem .

方法


详细描述

The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene .

要设置项的线条,传递 QLineF 给 QGraphicsLineItem 的构造函数,或调用 setLine () 函数。 line () 函数返回 the current line. By default the line is black with a width of 0, but you can change this by calling setPen ().

QGraphicsLineItem uses the line and the pen width to provide a reasonable implementation of boundingRect (), shape (),和 contains ()。 paint () function draws the line using the item's associated pen.


方法文档编制

QGraphicsLineItem.__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.

构造 QGraphicsLineItem . parent is passed to QGraphicsItem 's 构造函数。

另请参阅 QGraphicsScene.addItem ().

QGraphicsLineItem.__init__ ( self , QLineF   line , 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.

构造 QGraphicsLineItem ,使用 line 作为默认线条。 parent 会被传递给 QGraphicsItem 的构造函数。

另请参阅 QGraphicsScene.addItem ().

QGraphicsLineItem.__init__ ( self , float  x1 , float  y1 , float  x2 , float  y2 , 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.

构造 QGraphicsLineItem , using the line between ( x1 , y1 ) 和 ( x2 , y2 ) as the default line. parent 会被传递给 QGraphicsItem 的构造函数。

另请参阅 QGraphicsScene.addItem ().

QRectF QGraphicsLineItem.boundingRect ( self )

重实现自 QGraphicsItem.boundingRect ().

bool QGraphicsLineItem.contains ( self , QPointF   point )

重实现自 QGraphicsItem.contains ().

bool QGraphicsLineItem.isObscuredBy ( self , QGraphicsItem   item )

重实现自 QGraphicsItem.isObscuredBy ().

QLineF QGraphicsLineItem.line ( self )

Returns the item's line, or a null line if no line has been set.

另请参阅 setLine ().

QPainterPath QGraphicsLineItem.opaqueArea ( self )

重实现自 QGraphicsItem.opaqueArea ().

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

重实现自 QGraphicsItem.paint ().

QPen QGraphicsLineItem.pen ( self )

Returns the item's pen, or a black solid 0-width pen if no pen has been set.

另请参阅 setPen ().

QGraphicsLineItem.setLine ( self , QLineF   line )

将项的线条设为给定 line .

另请参阅 line ().

QGraphicsLineItem.setLine ( self , float  x1 , float  y1 , float  x2 , float  y2 )

这是重载函数。

Sets the item's line to be the line between ( x1 , y1 ) 和 ( x2 , y2 ).

这如同调用 setLine(QLineF(x1, y1, x2, y2)) .

QGraphicsLineItem.setPen ( self , QPen   pen )

将项的钢笔设为 pen . If no pen is set, the line will be painted using a black solid 0-width pen.

另请参阅 pen ().

QPainterPath QGraphicsLineItem.shape ( self )

重实现自 QGraphicsItem.shape ().

int QGraphicsLineItem.type ( self )

重实现自 QGraphicsItem.type ().