---
name: "QwtLegendItem"
section: "3"
platform: "linux"
package: "libqwt5-doc"
version: "5.2.3-1"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/QwtLegendItem"
---

# QwtLegendItem(3)

## NAME

QwtLegendItem -

## SYNOPSIS

`#include <qwt_legend_item.h>`

Inherits **QwtTextLabel**.

### Public Types

enum **IdentifierMode** { **NoIdentifier** =  0, **ShowLine** =  1, **ShowSymbol** =  2, **ShowText** =  4 }\

### Public Slots

void **setChecked** (bool on)\

### Signals

void **checked** (bool)\
 void **clicked** ()\
 void **pressed** ()\
 void **released** ()\

### Public Member Functions

**QwtLegendItem** (QWidget \*parent=0)\
 **QwtLegendItem** (const **QwtSymbol** &, const QPen &, const **QwtText** &, QWidget \*parent=0)\
 virtual **~QwtLegendItem** ()\
 const QPen & **curvePen** () const \
 virtual void **drawIdentifier** (QPainter \*, const QRect &) const \
 virtual void **drawItem** (QPainter \*p, const QRect &) const \
 int **identifierMode** () const \
 int **identifierWidth** () const \
 bool **isChecked** () const \
 **QwtLegend::LegendItemMode** **itemMode** () const \
 void **setCurvePen** (const QPen &)\
 void **setIdentifierMode** (int)\
 void **setIdentifierWidth** (int width)\
 void **setItemMode** (**QwtLegend::LegendItemMode**)\
 void **setSpacing** (int **spacing**)\
 void **setSymbol** (const **QwtSymbol** &)\
 virtual void **setText** (const **QwtText** &)\
 virtual QSize **sizeHint** () const \
 int **spacing** () const \
 const **QwtSymbol** & **symbol** () const \

### Protected Member Functions

virtual void **drawText** (QPainter \*, const QRect &)\
 bool **isDown** () const \
 virtual void **keyPressEvent** (QKeyEvent \*)\
 virtual void **keyReleaseEvent** (QKeyEvent \*)\
 virtual void **mousePressEvent** (QMouseEvent \*)\
 virtual void **mouseReleaseEvent** (QMouseEvent \*)\
 virtual void **paintEvent** (QPaintEvent \*)\
 void **setDown** (bool)\

## Detailed Description

A legend label.

**QwtLegendItem** represents a curve on a legend. It displays an curve identifier with an explaining text. The identifier might be a combination of curve symbol and line. In readonly mode it behaves like a label, otherwise like an unstylish push button.

**See also:**

**QwtLegend**, **QwtPlotCurve**

## Member Enumeration Documentation

### enum QwtLegendItem::IdentifierMode

Identifier mode. Default is ShowLine \| ShowText

**See also:**

**identifierMode()**, **setIdentifierMode()**

## Constructor & Destructor Documentation

### QwtLegendItem::QwtLegendItem (QWidget \*parent = `0`)` [explicit]`

**Parameters:**

*parent* Parent widget

### QwtLegendItem::QwtLegendItem (const QwtSymbol &symbol, const QPen &curvePen, const QwtText &text, QWidget \*parent = `0`)` [explicit]`

**Parameters:**

*symbol* Curve symbol \
 *curvePen* Curve pen \
 *text* Label text \
 *parent* Parent widget

## Member Function Documentation

### const QPen & QwtLegendItem::curvePen () const

**Returns:**

The curve pen.

**See also:**

**setCurvePen()**

### void QwtLegendItem::drawIdentifier (QPainter \*painter, const QRect &rect) const` [virtual]`

Paint the identifier to a given rect.

**Parameters:**

*painter* Painter \
 *rect* Rect where to paint

### void QwtLegendItem::drawItem (QPainter \*painter, const QRect &rect) const` [virtual]`

Draw the legend item to a given rect.

**Parameters:**

*painter* Painter \
 *rect* Rect where to paint the button

### int QwtLegendItem::identifierMode () const

Or'd values of IdentifierMode.

**See also:**

**setIdentifierMode()**, **IdentifierMode**

### int QwtLegendItem::identifierWidth () const

Return the width of the identifier

**See also:**

**setIdentifierWidth()**

### QwtLegend::LegendItemMode QwtLegendItem::itemMode () const

Return the item mode

**See also:**

**setItemMode()**

### void QwtLegendItem::setChecked (boolon)` [slot]`

Check/Uncheck a the item

**Parameters:**

*on* check/uncheck

**See also:**

**setItemMode()**

### void QwtLegendItem::setCurvePen (const QPen &pen)

Set curve pen.

**Parameters:**

*pen* Curve pen

**See also:**

**curvePen()**

### void QwtLegendItem::setIdentifierMode (intmode)

Set identifier mode. Default is ShowLine \| ShowText.

**Parameters:**

*mode* Or'd values of IdentifierMode

**See also:**

**identifierMode()**

### void QwtLegendItem::setIdentifierWidth (intwidth)

Set the width for the identifier Default is 8 pixels

**Parameters:**

*width* New width

**See also:**

**identifierMode()**, **identifierWidth()**

### void QwtLegendItem::setItemMode (QwtLegend::LegendItemModemode)

Set the item mode The default is QwtLegend::ReadOnlyItem

**Parameters:**

*mode* Item mode

**See also:**

**itemMode()**

### void QwtLegendItem::setSpacing (intspacing)

Change the spacing

**Parameters:**

*spacing* Spacing

**See also:**

**spacing()**, **identifierWidth()**, **QwtTextLabel::margin()**

### void QwtLegendItem::setSymbol (const QwtSymbol &symbol)

Set curve symbol.

**Parameters:**

*symbol* Symbol

**See also:**

**symbol()**

### void QwtLegendItem::setText (const QwtText &text)` [virtual]`

Set the text to the legend item

**Parameters:**

*text* Text label

**See also:**

**QwtTextLabel::text()**

Reimplemented from **QwtTextLabel**.

### int QwtLegendItem::spacing () const

Return the spacing

**See also:**

**setSpacing()**, **identifierWidth()**, **QwtTextLabel::margin()**

### const QwtSymbol & QwtLegendItem::symbol () const

**Returns:**

The curve symbol.

**See also:**

**setSymbol()**

## Author

Generated automatically by Doxygen for Qwt User's Guide from the source code.
