|  | Home · Overviews · Examples |

# QGraphicsLineItem Class Reference
[com.trolltech.qt.gui module]

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

Inherits .

## Detailed Description

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

To set the item's line, pass a `QLineF` to `QGraphicsLineItem`'s constructor, or call the `setLine` function. The `line` function returns 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`, and `contains`. The `paint` function draws the line using the item's associated pen.

See also `QGraphicsPathItem`, `QGraphicsRectItem`, `QGraphicsEllipseItem`, `QGraphicsTextItem`, `QGraphicsPolygonItem`, `QGraphicsPixmapItem`, and The Graphics View Framework.