source: ntrip/trunk/BNC/qwt/qwt_legend.h@ 8431

Last change on this file since 8431 was 8127, checked in by stoecker, 8 years ago

update qwt and qwtpolar, many QT5 fixes (unfinished)

File size: 3.4 KB
Line 
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_H
11#define QWT_LEGEND_H
12
13#include "qwt_global.h"
14#include "qwt_abstract_legend.h"
15#include <qvariant.h>
16
17class QScrollBar;
18
19/*!
20 \brief The legend widget
21
22 The QwtLegend widget is a tabular arrangement of legend items. Legend
23 items might be any type of widget, but in general they will be
24 a QwtLegendLabel.
25
26 \sa QwtLegendLabel, QwtPlotItem, QwtPlot
27*/
28
29class QWT_EXPORT QwtLegend : public QwtAbstractLegend
30{
31 Q_OBJECT
32
33public:
34 explicit QwtLegend( QWidget *parent = NULL );
35 virtual ~QwtLegend();
36
37 void setMaxColumns( uint numColums );
38 uint maxColumns() const;
39
40 void setDefaultItemMode( QwtLegendData::Mode );
41 QwtLegendData::Mode defaultItemMode() const;
42
43 QWidget *contentsWidget();
44 const QWidget *contentsWidget() const;
45
46 QWidget *legendWidget( const QVariant & ) const;
47 QList<QWidget *> legendWidgets( const QVariant & ) const;
48
49 QVariant itemInfo( const QWidget * ) const;
50
51 virtual bool eventFilter( QObject *, QEvent * );
52
53 virtual QSize sizeHint() const;
54 virtual int heightForWidth( int w ) const;
55
56 QScrollBar *horizontalScrollBar() const;
57 QScrollBar *verticalScrollBar() const;
58
59 virtual void renderLegend( QPainter *,
60 const QRectF &, bool fillBackground ) const;
61
62 virtual void renderItem( QPainter *,
63 const QWidget *, const QRectF &, bool fillBackground ) const;
64
65 virtual bool isEmpty() const;
66 virtual int scrollExtent( Qt::Orientation ) const;
67
68Q_SIGNALS:
69 /*!
70 A signal which is emitted when the user has clicked on
71 a legend label, which is in QwtLegendData::Clickable mode.
72
73 \param itemInfo Info for the item item of the
74 selected legend item
75 \param index Index of the legend label in the list of widgets
76 that are associated with the plot item
77
78 \note clicks are disabled as default
79 \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
80 */
81 void clicked( const QVariant &itemInfo, int index );
82
83 /*!
84 A signal which is emitted when the user has clicked on
85 a legend label, which is in QwtLegendData::Checkable mode
86
87 \param itemInfo Info for the item of the
88 selected legend label
89 \param index Index of the legend label in the list of widgets
90 that are associated with the plot item
91 \param on True when the legend label is checked
92
93 \note clicks are disabled as default
94 \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo()
95 */
96 void checked( const QVariant &itemInfo, bool on, int index );
97
98public Q_SLOTS:
99 virtual void updateLegend( const QVariant &,
100 const QList<QwtLegendData> & );
101
102protected Q_SLOTS:
103 void itemClicked();
104 void itemChecked( bool );
105
106protected:
107 virtual QWidget *createWidget( const QwtLegendData & ) const;
108 virtual void updateWidget( QWidget *widget, const QwtLegendData &data );
109
110private:
111 void updateTabOrder();
112
113 class PrivateData;
114 PrivateData *d_data;
115};
116
117#endif
Note: See TracBrowser for help on using the repository browser.