QGraphicsLineItem with an application-defined type integer and appearance helpers.
More...
#include <linegraphicsitem.h>
|
| | LineGraphicsItem (int type, QGraphicsItem *parent=nullptr) |
| | Construct with a type integer and optional parent item.
|
| |
| | LineGraphicsItem (const Line &line, int type, QGraphicsItem *parent=nullptr) |
| | Construct from a Line geometry object, with a type integer and optional parent.
|
| |
| virtual int | type () const override |
| | Return the application-defined type integer.
|
| |
| void | setWidth (double width) |
| | Set the pen width.
|
| |
| void | setColor (const QColor &color) |
| | Set the pen color.
|
| |
| virtual QRectF | boundingRect () const override |
| | Return the bounding rectangle (expanded to account for pen width).
|
| |
| virtual QPainterPath | shape () const override |
| | Return the shape used for hit testing.
|
| |
| void | setLength (double length) |
| | Set the length of the line, extending from its current start point.
|
| |
QGraphicsLineItem with an application-defined type integer and appearance helpers.
LineGraphicsItem stores a type integer (returned by type()) that allows qgraphicsitem_cast<> and scene item-type filtering to work with custom types. It also provides helpers for changing pen width, color, and line length.
Definition at line 15 of file linegraphicsitem.h.
◆ LineGraphicsItem() [1/2]
| LineGraphicsItem::LineGraphicsItem |
( |
int |
type, |
|
|
QGraphicsItem * |
parent = nullptr |
|
) |
| |
Construct with a type integer and optional parent item.
- Parameters
-
| type | Application-defined graphics item type |
| parent | Optional parent QGraphicsItem |
◆ LineGraphicsItem() [2/2]
| LineGraphicsItem::LineGraphicsItem |
( |
const Line & |
line, |
|
|
int |
type, |
|
|
QGraphicsItem * |
parent = nullptr |
|
) |
| |
Construct from a Line geometry object, with a type integer and optional parent.
- Parameters
-
| line | Line geometry to display |
| type | Application-defined graphics item type |
| parent | Optional parent QGraphicsItem |
◆ boundingRect()
| virtual QRectF LineGraphicsItem::boundingRect |
( |
| ) |
const |
|
overridevirtual |
Return the bounding rectangle (expanded to account for pen width).
- Returns
- Bounding rect in item coordinates
◆ setColor()
| void LineGraphicsItem::setColor |
( |
const QColor & |
color | ) |
|
Set the pen color.
- Parameters
-
| color | Color to apply to the pen |
◆ setLength()
| void LineGraphicsItem::setLength |
( |
double |
length | ) |
|
Set the length of the line, extending from its current start point.
- Parameters
-
| length | New length in scene units |
◆ setWidth()
| void LineGraphicsItem::setWidth |
( |
double |
width | ) |
|
Set the pen width.
- Parameters
-
| width | Pen width in scene units |
◆ shape()
| virtual QPainterPath LineGraphicsItem::shape |
( |
| ) |
const |
|
overridevirtual |
Return the shape used for hit testing.
- Returns
- Painter path representing the clickable area
◆ type()
| virtual int LineGraphicsItem::type |
( |
| ) |
const |
|
inlineoverridevirtual |
Return the application-defined type integer.
- Returns
- Item type value
Definition at line 37 of file linegraphicsitem.h.
The documentation for this class was generated from the following file: