# QwtLegendItem Class Reference

A widget representing something on a QwtLegend(). More...

`#include <qwt_legend_item.h>`

Inheritance diagram for QwtLegendItem:
[legend]

List of all members.

## Public Slots

void | clear ()
void | setChecked (bool on)
void | setText (const QString &, QwtText::TextFormat textFormat=QwtText::AutoText)

## Signals

void | checked (bool)
void | clicked ()
void | pressed ()
void | released ()

## Public Member Functions

virtual int | heightForWidth (int) const
QPixmap | identifier () const
QSize | identifierSize () const
int | indent () const
bool | isChecked () const
QwtLegend::LegendItemMode | itemMode () const
int | margin () const
virtual QSize | minimumSizeHint () const
| QwtLegendItem (QWidget *parent=0)
void | setIdentifier (const QPixmap &)
void | setIdentifierSize (const QSize &)
void | setIndent (int)
void | setItemMode (QwtLegend::LegendItemMode)
void | setMargin (int)
void | setSpacing (int spacing)
virtual void | setText (const QwtText &)
virtual QSize | sizeHint () const
int | spacing () const
const QwtText & | text () const
QRect | textRect () const
virtual | ~QwtLegendItem ()

## Protected Member Functions

virtual void | drawContents (QPainter *)
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 widget representing something on a QwtLegend().

## Constructor & Destructor Documentation

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

Parameters:

  parent | Parent widget

QwtLegendItem::~QwtLegendItem | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

void QwtLegendItem::checked | ( | bool |  | ) | `[signal]`

Signal, when the legend item has been toggled.

void QwtTextLabel::clear | ( |  | ) | `[slot, inherited]`

Clear the text and all QwtText attributes.

void QwtLegendItem::clicked | ( |  | ) | `[signal]`

Signal, when the legend item has been clicked.

void QwtTextLabel::drawContents | ( | QPainter * | painter | ) | `[protected, virtual, inherited]`

Redraw the text and focus indicator.

void QwtTextLabel::drawText | ( | QPainter * | painter,
|  | const QRect & | textRect
| ) |  | `[protected, virtual, inherited]`

Redraw the text.

int QwtTextLabel::heightForWidth | ( | int | width | ) | const`[virtual, inherited]`

Returns the preferred height for this widget, given the width.

Parameters:

  width | Width

QPixmap QwtLegendItem::identifier | ( |  | ) | const

Returns:
  pixmap representing a plot item

See also:
  setIdentifier()

QSize QwtLegendItem::identifierSize | ( |  | ) | const

Return the width of the identifier

See also:
  setIdentifierSize()

int QwtTextLabel::indent | ( |  | ) | const`[inherited]`

Return label's text indent in pixels.

bool QwtLegendItem::isChecked | ( |  | ) | const

Return true, if the item is checked.

bool QwtLegendItem::isDown | ( |  | ) | const`[protected]`

Return true, if the item is down.

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

Return the item mode

See also:
  setItemMode()

void QwtLegendItem::keyPressEvent | ( | QKeyEvent * | e | ) | `[protected, virtual]`

Handle key press events.

void QwtLegendItem::keyReleaseEvent | ( | QKeyEvent * | e | ) | `[protected, virtual]`

Handle key release events.

int QwtTextLabel::margin | ( |  | ) | const`[inherited]`

Return label's text indent in pixels.

QSize QwtTextLabel::minimumSizeHint | ( |  | ) | const`[virtual, inherited]`

Return a minimum size hint.

void QwtLegendItem::mousePressEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Handle mouse press events.

void QwtLegendItem::mouseReleaseEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Handle mouse release events.

void QwtLegendItem::paintEvent | ( | QPaintEvent * | e | ) | `[protected, virtual]`

Paint event.

Reimplemented from QwtTextLabel.

void QwtLegendItem::pressed | ( |  | ) | `[signal]`

Signal, when the legend item has been pressed.

void QwtLegendItem::released | ( |  | ) | `[signal]`

Signal, when the legend item has been relased.

void QwtLegendItem::setChecked | ( | bool | on | ) | `[slot]`

Check/Uncheck a the item

Parameters:

  on | check/uncheck

See also:
  setItemMode()

void QwtLegendItem::setDown | ( | bool | down | ) | `[protected]`

Set the item being down.

void QwtLegendItem::setIdentifier | ( | const QPixmap & | identifier | ) |

Assign the identifier The identifier needs to be created according to the identifierWidth()

Parameters:

  identifier | Pixmap representing a plot item

See also:
  identifier(), identifierWidth()

void QwtLegendItem::setIdentifierSize | ( | const QSize & | size | ) |

Set the size for the identifier Default is 8x8 pixels

Parameters:

  size | New size

See also:
  identifierSize()

void QwtTextLabel::setIndent | ( | int | indent | ) | `[inherited]`

Set label's text indent in pixels

Parameters:

  indent | Indentation in pixels

void QwtLegendItem::setItemMode | ( | QwtLegend::LegendItemMode | mode | ) |

Set the item mode The default is QwtLegend::ReadOnlyItem

Parameters:

  mode | Item mode

See also:
  itemMode()

void QwtTextLabel::setMargin | ( | int | margin | ) | `[inherited]`

Set label's margin in pixels

Parameters:

  margin | Margin in pixels

void QwtLegendItem::setSpacing | ( | int | spacing | ) |

Change the spacing

Parameters:

  spacing | Spacing

See also:
  spacing(), identifierWidth(), QwtTextLabel::margin()

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.

void QwtTextLabel::setText | ( | const QString & | text,
|  | QwtText::TextFormat | textFormat = `QwtText::AutoText`
| ) |  | `[slot, inherited]`

Change the label's text, keeping all other QwtText attributes

Parameters:

  text | New text
  textFormat | Format of text

See also:
  QwtText

QSize QwtLegendItem::sizeHint | ( |  | ) | const`[virtual]`

Return a size hint.

Reimplemented from QwtTextLabel.

int QwtLegendItem::spacing | ( |  | ) | const

Return the spacing

See also:
  setSpacing(), identifierWidth(), QwtTextLabel::margin()

const QwtText & QwtTextLabel::text | ( |  | ) | const`[inherited]`

Return the text.

QRect QwtTextLabel::textRect | ( |  | ) | const`[inherited]`

Calculate the rect for the text in widget coordinates

Returns:
  Text rect