QwtLegendItem Class Reference

Inheritance diagram for QwtLegendItem:

Inheritance graph
[legend]
Collaboration diagram for QwtLegendItem:

Collaboration graph
[legend]
List of all members.

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

Definition at line 35 of file qwt_legend_item.h.

Public Types

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

Public Slots

void setChecked (bool on)

Signals

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

Public Member Functions

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

Protected Member Functions

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


Member Enumeration Documentation

enum QwtLegendItem::IdentifierMode

Identifier mode.

Default is ShowLine | ShowText

See also:
QwtLegendItem::identifierMode, QwtLegendItem::setIdentifierMode

Definition at line 47 of file qwt_legend_item.h.


Constructor & Destructor Documentation

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

Parameters:
parent Parent widget

Definition at line 80 of file qwt_legend_item.cpp.

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

Definition at line 93 of file qwt_legend_item.cpp.

References QwtSymbol::clone(), symbol(), and QwtTextLabel::text().

QwtLegendItem::~QwtLegendItem (  )  [virtual]

Destructor.

Definition at line 116 of file qwt_legend_item.cpp.


Member Function Documentation

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.

Definition at line 128 of file qwt_legend_item.cpp.

References QwtText::setRenderFlags(), QwtTextLabel::setText(), and QwtTextLabel::text().

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

Set the item mode The default is QwtLegend::ReadOnlyItem

Parameters:
mode Item mode
See also:
itemMode()

Definition at line 150 of file qwt_legend_item.cpp.

References QwtTextLabel::setMargin().

QwtLegend::LegendItemMode QwtLegendItem::itemMode (  )  const

Return the item mode

See also:
setItemMode()

Definition at line 169 of file qwt_legend_item.cpp.

void QwtLegendItem::setIdentifierMode ( int  mode  ) 

Set identifier mode. Default is ShowLine | ShowText.

Parameters:
mode Or'd values of IdentifierMode
See also:
identifierMode()

Definition at line 181 of file qwt_legend_item.cpp.

int QwtLegendItem::identifierMode (  )  const

Or'd values of IdentifierMode.

See also:
setIdentifierMode(), IdentifierMode

Definition at line 194 of file qwt_legend_item.cpp.

void QwtLegendItem::setIdentfierWidth ( int  width  ) 

Set the width for the identifier Default is 8 pixels

Parameters:
width New width
See also:
identifierMode(), identifierWidth

Definition at line 207 of file qwt_legend_item.cpp.

References QwtTextLabel::margin(), and QwtTextLabel::setIndent().

int QwtLegendItem::identifierWidth (  )  const

Return the width of the identifier

See also:
setIdentfierWidth

Definition at line 222 of file qwt_legend_item.cpp.

Referenced by drawItem().

void QwtLegendItem::setSpacing ( int  spacing  ) 

Change the spacing

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

Definition at line 232 of file qwt_legend_item.cpp.

References QwtTextLabel::margin(), and QwtTextLabel::setIndent().

int QwtLegendItem::spacing (  )  const

Return the spacing

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

Definition at line 247 of file qwt_legend_item.cpp.

Referenced by drawItem().

void QwtLegendItem::setSymbol ( const QwtSymbol symbol  ) 

Set curve symbol.

Parameters:
symbol Symbol
See also:
symbol()

Definition at line 258 of file qwt_legend_item.cpp.

References QwtSymbol::clone(), and symbol().

const QwtSymbol & QwtLegendItem::symbol (  )  const

Returns:
The curve symbol.
See also:
setSymbol()

Definition at line 269 of file qwt_legend_item.cpp.

Referenced by QwtLegendItem(), and setSymbol().

void QwtLegendItem::setCurvePen ( const QPen &  pen  ) 

Set curve pen.

Parameters:
pen Curve pen
See also:
curvePen()

Definition at line 281 of file qwt_legend_item.cpp.

const QPen & QwtLegendItem::curvePen (  )  const

Returns:
The curve pen.
See also:
setCurvePen()

Definition at line 294 of file qwt_legend_item.cpp.

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

Definition at line 304 of file qwt_legend_item.cpp.

References QwtPainter::drawLine(), QwtPainter::metricsMap(), and QwtMetricsMap::screenToLayout().

Referenced by drawItem(), and paintEvent().

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

Definition at line 360 of file qwt_legend_item.cpp.

References QwtText::draw(), drawIdentifier(), identifierWidth(), QwtTextLabel::margin(), QwtPainter::metricsMap(), QwtMetricsMap::screenToLayoutX(), spacing(), and QwtTextLabel::text().

QSize QwtLegendItem::sizeHint (  )  const [virtual]

Return a size hint.

Reimplemented from QwtTextLabel.

Definition at line 578 of file qwt_legend_item.cpp.

References QwtTextLabel::sizeHint().

bool QwtLegendItem::isChecked (  )  const

Return true, if the item is checked.

Definition at line 542 of file qwt_legend_item.cpp.

References isDown().

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

Check/Uncheck a the item

Parameters:
on check/uncheck
See also:
setItemMode()

Definition at line 528 of file qwt_legend_item.cpp.

References setDown().

void QwtLegendItem::clicked (  )  [signal]

Signal, when the legend item has been clicked.

Referenced by setDown().

void QwtLegendItem::pressed (  )  [signal]

Signal, when the legend item has been pressed.

Referenced by setDown().

void QwtLegendItem::released (  )  [signal]

Signal, when the legend item has been relased.

Referenced by setDown().

void QwtLegendItem::checked ( bool   )  [signal]

Signal, when the legend item has been toggled.

Referenced by setDown().

void QwtLegendItem::setDown ( bool   )  [protected]

Set the item being down.

Definition at line 548 of file qwt_legend_item.cpp.

References checked(), clicked(), pressed(), and released().

Referenced by keyPressEvent(), keyReleaseEvent(), mousePressEvent(), mouseReleaseEvent(), and setChecked().

bool QwtLegendItem::isDown (  )  const [protected]

Return true, if the item is down.

Definition at line 572 of file qwt_legend_item.cpp.

Referenced by isChecked(), keyPressEvent(), and mousePressEvent().

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

Paint event.

Reimplemented from QwtTextLabel.

Definition at line 385 of file qwt_legend_item.cpp.

References QwtTextLabel::drawContents(), drawIdentifier(), and QwtTextLabel::margin().

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

Handle mouse press events.

Definition at line 428 of file qwt_legend_item.cpp.

References isDown(), and setDown().

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

Handle mouse release events.

Definition at line 451 of file qwt_legend_item.cpp.

References setDown().

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

Handle key press events.

Definition at line 473 of file qwt_legend_item.cpp.

References isDown(), and setDown().

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

Handle key release events.

Definition at line 499 of file qwt_legend_item.cpp.

References setDown().

void QwtLegendItem::drawText ( QPainter *  ,
const QRect &   
) [protected, virtual]

Redraw the text.

Reimplemented from QwtTextLabel.

Definition at line 587 of file qwt_legend_item.cpp.

References QwtTextLabel::drawText().


Generated on Thu May 1 15:44:40 2008 for Qwt User's Guide by  doxygen 1.5.0