QGraphicsLineItem

Synopsis

Functions

Detailed Description

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

To set the item’s line, pass a PySide.QtCore.QLineF to PySide.QtGui.QGraphicsLineItem ‘s constructor, or call the PySide.QtGui.QGraphicsLineItem.setLine() function. The PySide.QtGui.QGraphicsLineItem.line() function returns the current line. By default the line is black with a width of 0, but you can change this by calling PySide.QtGui.QGraphicsLineItem.setPen() .

../../_images/graphicsview-lineitem.png

PySide.QtGui.QGraphicsLineItem uses the line and the pen width to provide a reasonable implementation of PySide.QtGui.QGraphicsLineItem.boundingRect() , PySide.QtGui.QGraphicsLineItem.shape() , and PySide.QtGui.QGraphicsLineItem.contains() . The PySide.QtGui.QGraphicsLineItem.paint() function draws the line using the item’s associated pen.

class PySide.QtGui.QGraphicsLineItem([parent=None[, scene=None]])
class PySide.QtGui.QGraphicsLineItem(line[, parent=None[, scene=None]])
class PySide.QtGui.QGraphicsLineItem(x1, y1, x2, y2[, parent=None[, scene=None]])
Parameters:
PySide.QtGui.QGraphicsLineItem.line()
Return type:PySide.QtCore.QLineF

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

PySide.QtGui.QGraphicsLineItem.pen()
Return type:PySide.QtGui.QPen

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

PySide.QtGui.QGraphicsLineItem.setLine(x1, y1, x2, y2)
Parameters:
  • x1PySide.QtCore.qreal
  • y1PySide.QtCore.qreal
  • x2PySide.QtCore.qreal
  • y2PySide.QtCore.qreal

This is an overloaded function.

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

This is the same as calling setLine(QLineF(x1, y1, x2, y2)) .

PySide.QtGui.QGraphicsLineItem.setLine(line)
Parameters:linePySide.QtCore.QLineF

Sets the item’s line to be the given line .

PySide.QtGui.QGraphicsLineItem.setPen(pen)
Parameters:penPySide.QtGui.QPen

Sets the item’s pen to pen . If no pen is set, the line will be painted using a black solid 0-width pen.