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.
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 QwtSymbol & | symbol () 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 &) |
QwtLegendItem::QwtLegendItem | ( | QWidget * | parent = 0 |
) | [explicit] |
QwtLegendItem::QwtLegendItem | ( | const QwtSymbol & | symbol, | |
const QPen & | curvePen, | |||
const QwtText & | text, | |||
QWidget * | parent = 0 | |||
) | [explicit] |
symbol | Curve symbol | |
curvePen | Curve pen | |
text | Label text | |
parent | Parent widget |
Definition at line 87 of file qwt_legend_item.cpp.
References symbol(), and QwtTextLabel::text().
QwtLegendItem::~QwtLegendItem | ( | ) | [virtual] |
void QwtLegendItem::setText | ( | const QwtText & | text | ) | [virtual] |
Set the text to the legend item
text | Text label |
Reimplemented from QwtTextLabel.
Definition at line 120 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
mode | Item mode |
Definition at line 142 of file qwt_legend_item.cpp.
References QwtLegend::ReadOnlyItem, and QwtTextLabel::setMargin().
QwtLegend::LegendItemMode QwtLegendItem::itemMode | ( | ) | const |
void QwtLegendItem::setIdentifierMode | ( | int | mode | ) |
Set identifier mode. Default is ShowLine | ShowText.
mode | Or'd values of IdentifierMode |
Definition at line 173 of file qwt_legend_item.cpp.
int QwtLegendItem::identifierMode | ( | ) | const |
Or'd values of IdentifierMode.
Definition at line 186 of file qwt_legend_item.cpp.
void QwtLegendItem::setIdentfierWidth | ( | int | width | ) |
Set the width for the identifier Default is 8 pixels
width | New width |
Definition at line 199 of file qwt_legend_item.cpp.
References QwtTextLabel::margin(), and QwtTextLabel::setIndent().
int QwtLegendItem::identifierWidth | ( | ) | const |
Return the width of the identifier
Definition at line 214 of file qwt_legend_item.cpp.
Referenced by drawItem().
void QwtLegendItem::setSpacing | ( | int | spacing | ) |
Change the spacing
spacing | Spacing |
Definition at line 224 of file qwt_legend_item.cpp.
References QwtTextLabel::margin(), and QwtTextLabel::setIndent().
int QwtLegendItem::spacing | ( | ) | const |
Return the spacing
Definition at line 239 of file qwt_legend_item.cpp.
Referenced by drawItem().
void QwtLegendItem::setSymbol | ( | const QwtSymbol & | symbol | ) |
Set curve symbol.
symbol | Symbol |
Definition at line 250 of file qwt_legend_item.cpp.
References symbol().
const QwtSymbol & QwtLegendItem::symbol | ( | ) | const |
Definition at line 263 of file qwt_legend_item.cpp.
Referenced by QwtLegendItem(), and setSymbol().
void QwtLegendItem::setCurvePen | ( | const QPen & | pen | ) |
Set curve pen.
pen | Curve pen |
Definition at line 275 of file qwt_legend_item.cpp.
const QPen & QwtLegendItem::curvePen | ( | ) | const |
void QwtLegendItem::drawIdentifier | ( | QPainter * | painter, | |
const QRect & | rect | |||
) | const [virtual] |
Paint the identifier to a given rect.
painter | Painter | |
rect | Rect where to paint |
Definition at line 298 of file qwt_legend_item.cpp.
References QwtPainter::drawLine(), QwtPainter::metricsMap(), QwtSymbol::NoSymbol, QwtMetricsMap::screenToLayout(), ShowLine, and ShowSymbol.
Referenced by drawItem(), and paintEvent().
void QwtLegendItem::drawItem | ( | QPainter * | painter, | |
const QRect & | rect | |||
) | const [virtual] |
Draw the legend item to a given rect.
painter | Painter | |
rect | Rect where to paint the button |
Definition at line 354 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 label's margin in pixels.
Reimplemented from QwtTextLabel.
Definition at line 526 of file qwt_legend_item.cpp.
References QwtLegend::ReadOnlyItem, and QwtTextLabel::sizeHint().
void QwtLegendItem::clicked | ( | ) | [signal] |
void QwtLegendItem::pressed | ( | ) | [signal] |
void QwtLegendItem::released | ( | ) | [signal] |
void QwtLegendItem::checked | ( | bool | ) | [signal] |
void QwtLegendItem::paintEvent | ( | QPaintEvent * | e | ) | [protected, virtual] |
Qt paint event.
Reimplemented from QwtTextLabel.
Definition at line 378 of file qwt_legend_item.cpp.
References QwtTextLabel::drawContents(), drawIdentifier(), QwtTextLabel::margin(), and QwtLegend::ReadOnlyItem.
void QwtLegendItem::drawText | ( | QPainter * | , | |
const QRect & | ||||
) | [protected, virtual] |
Redraw the text.
Reimplemented from QwtTextLabel.
Definition at line 535 of file qwt_legend_item.cpp.
References QwtTextLabel::drawText().