1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the Qwt License, Version 1.0
8
*****************************************************************************/
12
#ifndef QWT_LEGEND_ITEM_H
13
#define QWT_LEGEND_ITEM_H
15
#include "qwt_global.h"
16
#include "qwt_legend.h"
18
#include "qwt_text_label.h"
27
QwtLegendItem represents a curve on a legend.
28
It displays an curve identifier with an explaining text.
29
The identifier might be a combination of curve symbol and line.
30
In readonly mode it behaves like a label, otherwise like
31
an unstylish push button.
33
\sa QwtLegend, QwtPlotCurve
35
class QWT_EXPORT QwtLegendItem: public QwtTextLabel
41
\brief Identifier mode
43
Default is ShowLine | ShowText
44
\sa QwtLegendItem::identifierMode, QwtLegendItem::setIdentifierMode
55
explicit QwtLegendItem(QWidget *parent = 0);
56
explicit QwtLegendItem(const QwtSymbol &, const QPen &,
57
const QwtText &, QWidget *parent = 0);
58
virtual ~QwtLegendItem();
60
virtual void setText(const QwtText &);
62
void setItemMode(QwtLegend::LegendItemMode);
63
QwtLegend::LegendItemMode itemMode() const;
65
void setIdentifierMode(int);
66
int identifierMode() const;
68
void setIdentfierWidth(int width);
69
int identifierWidth() const;
71
void setSpacing(int spacing);
74
void setSymbol(const QwtSymbol &);
75
const QwtSymbol& symbol() const;
77
void setCurvePen(const QPen &);
78
const QPen& curvePen() const;
80
virtual void drawIdentifier(QPainter *, const QRect &) const;
81
virtual void drawItem(QPainter *p, const QRect &) const;
83
virtual QSize sizeHint() const;
85
bool isChecked() const;
88
void setChecked(bool on);
91
//! Signal, when the legend item has been clicked
94
//! Signal, when the legend item has been pressed
97
//! Signal, when the legend item has been relased
100
//! Signal, when the legend item has been toggled
107
virtual void paintEvent(QPaintEvent *);
108
virtual void mousePressEvent(QMouseEvent *);
109
virtual void mouseReleaseEvent(QMouseEvent *);
110
virtual void keyPressEvent(QKeyEvent *);
111
virtual void keyReleaseEvent(QKeyEvent *);
113
virtual void drawText(QPainter *, const QRect &);
116
void init(const QwtText &);
122
#endif // QWT_LEGEND_ITEM_H