Qwt User's Guide 6.1.2

- Main Page
- Related Pages
- Classes

All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_plot_legenditem.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_PLOT_LEGEND_ITEM_H
11 #define QWT_PLOT_LEGEND_ITEM_H
12
13 #include "qwt_global.h"
14 #include "qwt_plot_item.h"
15 #include "qwt_legend_data.h"
16
17 class QFont;
18
42 class QWT_EXPORT QwtPlotLegendItem: public QwtPlotItem
43 {
44 public:
55 enum BackgroundMode
56 {
58 LegendBackground,
59
61 ItemBackground
62 };
63
64 explicit QwtPlotLegendItem();
65 virtual ~QwtPlotLegendItem();
66
67 virtual int rtti() const;
68
69 void setAlignment( Qt::Alignment );
70 Qt::Alignment alignment() const;
71
72 void setMaxColumns( uint );
73 uint maxColumns() const;
74
75 void setMargin( int );
76 int margin() const;
77
78 void setSpacing( int );
79 int spacing() const;
80
81 void setItemMargin( int );
82 int itemMargin() const;
83
84 void setItemSpacing( int );
85 int itemSpacing() const;
86
87 void setFont( const QFont& );
88 QFont font() const;
89
90 void setBorderDistance( int numPixels );
91 int borderDistance() const;
92
93 void setBorderRadius( double );
94 double borderRadius() const;
95
96 void setBorderPen( const QPen & );
97 QPen borderPen() const;
98
99 void setBackgroundBrush( const QBrush & );
100 QBrush backgroundBrush() const;
101
102 void setBackgroundMode( BackgroundMode );
103 BackgroundMode backgroundMode() const;
104
105 void setTextPen( const QPen & );
106 QPen textPen() const;
107
108 virtual void draw( QPainter *p,
109 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
110 const QRectF &rect ) const;
111
112 void clearLegend();
113
114 virtual void updateLegend( const QwtPlotItem *,
115 const QList<QwtLegendData> & );
116
117 virtual QRect geometry( const QRectF &canvasRect ) const;
118
119 virtual QSize minimumSize( const QwtLegendData & ) const;
120 virtual int heightForWidth( const QwtLegendData &, int w ) const;
121
122 QList< const QwtPlotItem * > plotItems() const;
123 QList< QRect > legendGeometries( const QwtPlotItem * ) const;
124
125 protected:
126 virtual void drawLegendData( QPainter *painter,
127 const QwtPlotItem *, const QwtLegendData &, const QRectF & ) const;
128
129 virtual void drawBackground( QPainter *, const QRectF &rect ) const;
130
131 private:
132 class PrivateData;
133 PrivateData *d_data;
134 };
135
136 #endif
QwtPlotItem::draw
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item.
QwtPlotItem
Base class for items on the plot canvas.
Definition: qwt_plot_item.h:64
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:30
QwtPlotLegendItem::LegendBackground
The legend has a background.
Definition: qwt_plot_legenditem.h:58
QwtPlotItem::rtti
virtual int rtti() const
Definition: qwt_plot_item.cpp:120
QwtLegendData
Attributes of an entry on a legend.
Definition: qwt_legend_data.h:35
QwtPlotItem::updateLegend
virtual void updateLegend(const QwtPlotItem *, const QList< QwtLegendData > &)
Update the item to changes of the legend info.
Definition: qwt_plot_item.cpp:661
QwtPlotLegendItem::BackgroundMode
BackgroundMode
Background mode.
Definition: qwt_plot_legenditem.h:55
QwtPlotLegendItem
A class which draws a legend inside the plot canvas.
Definition: qwt_plot_legenditem.h:42