QGraphicsLineItem Class

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

Header: #include <QGraphicsLineItem>
qmake: QT += widgets
Since: Qt 4.2
Inherits: QGraphicsItem

This class was introduced in Qt 4.2.

Public Types

enum anonymous { Type }

Detailed Description

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 Graphics View Framework.

Member Type Documentation

enum QGraphicsLineItem::anonymous

The value returned by the virtual type() function.

ConstantValueDescription
QGraphicsLineItem::Type6A graphics line item