Qwt User's Guide 5.2.3

- Main Page
- Related Pages
- Classes

qwt_legend_item.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
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 *****************************************************************************/
9
10 // vim: expandtab
11
12 #ifndef QWT_LEGEND_ITEM_H
13 #define QWT_LEGEND_ITEM_H
14
15 #include "qwt_global.h"
16 #include "qwt_legend.h"
17 #include "qwt_text.h"
18 #include "qwt_text_label.h"
19
20 class QPainter;
21 class QPen;
22 class QwtSymbol;
23
35 class QWT_EXPORT QwtLegendItem: public QwtTextLabel
36 {
37 Q_OBJECT
38 public:
39
47 enum IdentifierMode
48 {
49 NoIdentifier = 0,
50 ShowLine = 1,
51 ShowSymbol = 2,
52 ShowText = 4
53 };
54
55 explicit QwtLegendItem(QWidget *parent = 0);
56 explicit QwtLegendItem(const QwtSymbol &, const QPen &,
57 const QwtText &, QWidget *parent = 0);
58 virtual ~QwtLegendItem();
59
60 virtual void setText(const QwtText &);
61
62 void setItemMode(QwtLegend::LegendItemMode);
63 QwtLegend::LegendItemMode itemMode() const;
64
65 void setIdentifierMode(int);
66 int identifierMode() const;
67
68 void setIdentifierWidth(int width);
69 int identifierWidth() const;
70
71 void setSpacing(int spacing);
72 int spacing() const;
73
74 void setSymbol(const QwtSymbol &);
75 const QwtSymbol& symbol() const;
76
77 void setCurvePen(const QPen &);
78 const QPen& curvePen() const;
79
80 virtual void drawIdentifier(QPainter *, const QRect &) const;
81 virtual void drawItem(QPainter *p, const QRect &) const;
82
83 virtual QSize sizeHint() const;
84
85 bool isChecked() const;
86
87 public slots:
88 void setChecked(bool on);
89
90 signals:
92 void clicked();
93
95 void pressed();
96
98 void released();
99
101 void checked(bool);
102
103 protected:
104 void setDown(bool);
105 bool isDown() const;
106
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 *);
112
113 virtual void drawText(QPainter *, const QRect &);
114
115 private:
116 void init(const QwtText &);
117
118 class PrivateData;
119 PrivateData *d_data;
120 };
121
122 #endif // QWT_LEGEND_ITEM_H