Qwt User's Guide  6.1.3
qwt_legend_label.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 #ifndef QWT_LEGEND_LABEL_H
11 #define QWT_LEGEND_LABEL_H
12 
13 #include "qwt_global.h"
14 #include "qwt_legend_data.h"
15 #include "qwt_text.h"
16 #include "qwt_text_label.h"
17 #include <qpixmap.h>
18 
19 class QwtLegendData;
20 
24 class QWT_EXPORT QwtLegendLabel: public QwtTextLabel
25 {
26  Q_OBJECT
27 public:
28  explicit QwtLegendLabel( QWidget *parent = 0 );
29  virtual ~QwtLegendLabel();
30 
31  void setData( const QwtLegendData & );
32  const QwtLegendData &data() const;
33 
34  void setItemMode( QwtLegendData::Mode );
35  QwtLegendData::Mode itemMode() const;
36 
37  void setSpacing( int spacing );
38  int spacing() const;
39 
40  virtual void setText( const QwtText & );
41 
42  void setIcon( const QPixmap & );
43  QPixmap icon() const;
44 
45  virtual QSize sizeHint() const;
46 
47  bool isChecked() const;
48 
49 public Q_SLOTS:
50  void setChecked( bool on );
51 
52 Q_SIGNALS:
54  void clicked();
55 
57  void pressed();
58 
60  void released();
61 
63  void checked( bool );
64 
65 protected:
66  void setDown( bool );
67  bool isDown() const;
68 
69  virtual void paintEvent( QPaintEvent * );
70  virtual void mousePressEvent( QMouseEvent * );
71  virtual void mouseReleaseEvent( QMouseEvent * );
72  virtual void keyPressEvent( QKeyEvent * );
73  virtual void keyReleaseEvent( QKeyEvent * );
74 
75 private:
76  class PrivateData;
77  PrivateData *d_data;
78 };
79 
80 #endif
A Widget which displays a QwtText.
Definition: qwt_text_label.h:25
A class representing a text.
Definition: qwt_text.h:51
virtual QSize sizeHint() const
Return a size hint.
Definition: qwt_text_label.cpp:168
void setText(const QString &, QwtText::TextFormat textFormat=QwtText::AutoText)
Definition: qwt_text_label.cpp:92
A widget representing something on a QwtLegend.
Definition: qwt_legend_label.h:24
Attributes of an entry on a legend.
Definition: qwt_legend_data.h:35
Mode
Mode defining how a legend entry interacts.
Definition: qwt_legend_data.h:39
virtual void paintEvent(QPaintEvent *e)
Definition: qwt_text_label.cpp:228