QWT 7.0.1
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_LEGEND_H
28#define QWT_LEGEND_H
29
30#include "qwt_global.h"
31#include "qwt_abstract_legend.h"
32#include "qwt_legend_data.h"
33
34#include <qvariant.h>
35
36class QScrollBar;
37
48class QWT_EXPORT QwtLegend : public QwtAbstractLegend
49{
50 Q_OBJECT
51
52 public:
53 explicit QwtLegend( QWidget* parent = NULL );
54 virtual ~QwtLegend();
55
56 void setMaxColumns( uint numColums );
57 uint maxColumns() const;
58
59 void setDefaultItemMode( QwtLegendData::Mode );
60 QwtLegendData::Mode defaultItemMode() const;
61
62 QWidget* contentsWidget();
63 const QWidget* contentsWidget() const;
64
65 QWidget* legendWidget( const QVariant& ) const;
66 QList< QWidget* > legendWidgets( const QVariant& ) const;
67
68 QVariant itemInfo( const QWidget* ) const;
69
70 virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
71
72 virtual QSize sizeHint() const QWT_OVERRIDE;
73 virtual int heightForWidth( int w ) const QWT_OVERRIDE;
74
75 QScrollBar* horizontalScrollBar() const;
76 QScrollBar* verticalScrollBar() const;
77
78 virtual void renderLegend( QPainter*,
79 const QRectF&, bool fillBackground ) const QWT_OVERRIDE;
80
81 virtual void renderItem( QPainter*,
82 const QWidget*, const QRectF&, bool fillBackground ) const;
83
84 virtual bool isEmpty() const QWT_OVERRIDE;
85 virtual int scrollExtent( Qt::Orientation ) const QWT_OVERRIDE;
86
87 Q_SIGNALS:
100 void clicked( const QVariant& itemInfo, int index );
101
115 void checked( const QVariant& itemInfo, bool on, int index );
116
117 public Q_SLOTS:
118 virtual void updateLegend( const QVariant&,
119 const QList< QwtLegendData >& ) QWT_OVERRIDE;
120
121 protected Q_SLOTS:
122 void itemClicked();
123 void itemChecked( bool );
124
125 protected:
126 virtual QWidget* createWidget( const QwtLegendData& ) const;
127 virtual void updateWidget( QWidget*, const QwtLegendData& );
128
129 private:
130 void updateTabOrder();
131
132 class PrivateData;
133 PrivateData* m_data;
134};
135
136#endif
Definition qwt_dyngrid_layout.h:33
Abstract base class for legend widgets.
Definition qwt_abstract_legend.h:50
virtual void renderLegend(QPainter *painter, const QRectF &rect, bool fillBackground) const =0
Render the legend into a given rectangle.
virtual int scrollExtent(Qt::Orientation) const
Return the extent, that is needed for elements to scroll the legend ( usually scrollbars ),...
Definition qwt_abstract_legend.cpp:51
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.
Definition qwt_legend_data.h:54
Mode
Mode defining how a legend entry interacts.
Definition qwt_legend_data.h:58
The legend widget.
Definition qwt_legend.h:49
void clicked(const QVariant &itemInfo, int index)
A signal which is emitted when the user has clicked on a legend label, which is in QwtLegendData::Cli...
void checked(const QVariant &itemInfo, bool on, int index)
A signal which is emitted when the user has clicked on a legend label, which is in QwtLegendData::Che...