Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_legend.h
1/******************************************************************************
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_H
11#define QWT_LEGEND_H
12
13#include "qwt_global.h"
14#include "qwt_abstract_legend.h"
15#include "qwt_legend_data.h"
16
17#include <qvariant.h>
18
19class QScrollBar;
20
31class QWT_EXPORT QwtLegend : public QwtAbstractLegend
32{
33 Q_OBJECT
34
35 public:
36 explicit QwtLegend( QWidget* parent = NULL );
37 virtual ~QwtLegend();
38
39 void setMaxColumns( uint numColums );
40 uint maxColumns() const;
41
42 void setDefaultItemMode( QwtLegendData::Mode );
43 QwtLegendData::Mode defaultItemMode() const;
44
45 QWidget* contentsWidget();
46 const QWidget* contentsWidget() const;
47
48 QWidget* legendWidget( const QVariant& ) const;
49 QList< QWidget* > legendWidgets( const QVariant& ) const;
50
51 QVariant itemInfo( const QWidget* ) const;
52
53 virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
54
55 virtual QSize sizeHint() const QWT_OVERRIDE;
56 virtual int heightForWidth( int w ) const QWT_OVERRIDE;
57
58 QScrollBar* horizontalScrollBar() const;
59 QScrollBar* verticalScrollBar() const;
60
61 virtual void renderLegend( QPainter*,
62 const QRectF&, bool fillBackground ) const QWT_OVERRIDE;
63
64 virtual void renderItem( QPainter*,
65 const QWidget*, const QRectF&, bool fillBackground ) const;
66
67 virtual bool isEmpty() const QWT_OVERRIDE;
68 virtual int scrollExtent( Qt::Orientation ) const QWT_OVERRIDE;
69
70 Q_SIGNALS:
83 void clicked( const QVariant& itemInfo, int index );
84
98 void checked( const QVariant& itemInfo, bool on, int index );
99
100 public Q_SLOTS:
101 virtual void updateLegend( const QVariant&,
102 const QList< QwtLegendData >& ) QWT_OVERRIDE;
103
104 protected Q_SLOTS:
105 void itemClicked();
106 void itemChecked( bool );
107
108 protected:
109 virtual QWidget* createWidget( const QwtLegendData& ) const;
110 virtual void updateWidget( QWidget*, const QwtLegendData& );
111
112 private:
113 void updateTabOrder();
114
115 class PrivateData;
116 PrivateData* m_data;
117};
118
119#endif
Abstract base class for legend widgets.
virtual void renderLegend(QPainter *painter, const QRectF &rect, bool fillBackground) const =0
virtual int scrollExtent(Qt::Orientation) const
virtual bool isEmpty() const =0
virtual void updateLegend(const QVariant &itemInfo, const QList< QwtLegendData > &data)=0
Update the entries for a plot item.
Attributes of an entry on a legend.
Mode
Mode defining how a legend entry interacts.
The legend widget.
Definition qwt_legend.h:32
void clicked(const QVariant &itemInfo, int index)
void checked(const QVariant &itemInfo, bool on, int index)