Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_plot_legenditem.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_PLOT_LEGEND_ITEM_H
11#define QWT_PLOT_LEGEND_ITEM_H
12
13#include "qwt_global.h"
14#include "qwt_plot_item.h"
15
16class QFont;
17
41class QWT_EXPORT QwtPlotLegendItem : public QwtPlotItem
42{
43 public:
55 {
58
60 ItemBackground
61 };
62
63 explicit QwtPlotLegendItem();
64 virtual ~QwtPlotLegendItem();
65
66 virtual int rtti() const QWT_OVERRIDE;
67
68 void setAlignmentInCanvas( Qt::Alignment );
69 Qt::Alignment alignmentInCanvas() const;
70
71 void setOffsetInCanvas( Qt::Orientations, int numPixels );
72 int offsetInCanvas( Qt::Orientation ) const;
73
74 void setMaxColumns( uint );
75 uint maxColumns() const;
76
77 void setMargin( int );
78 int margin() const;
79
80 void setSpacing( int );
81 int spacing() const;
82
83 void setItemMargin( int );
84 int itemMargin() const;
85
86 void setItemSpacing( int );
87 int itemSpacing() const;
88
89 void setFont( const QFont& );
90 QFont font() const;
91
92 void setBorderRadius( double );
93 double borderRadius() const;
94
95 void setBorderPen( const QPen& );
96 QPen borderPen() const;
97
98 void setBackgroundBrush( const QBrush& );
99 QBrush backgroundBrush() const;
100
101 void setBackgroundMode( BackgroundMode );
102 BackgroundMode backgroundMode() const;
103
104 void setTextPen( const QPen& );
105 QPen textPen() const;
106
107 virtual void draw( QPainter*,
108 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
109 const QRectF& canvasRect ) const QWT_OVERRIDE;
110
111 void clearLegend();
112
113 virtual void updateLegend( const QwtPlotItem*,
114 const QList< QwtLegendData >& ) QWT_OVERRIDE;
115
116 virtual QRect geometry( const QRectF& canvasRect ) const;
117
118 virtual QSize minimumSize( const QwtLegendData& ) const;
119 virtual int heightForWidth( const QwtLegendData&, int width ) const;
120
121 QList< const QwtPlotItem* > plotItems() const;
122 QList< QRect > legendGeometries( const QwtPlotItem* ) const;
123
124 protected:
125 virtual void drawLegendData( QPainter*,
126 const QwtPlotItem*, const QwtLegendData&, const QRectF& ) const;
127
128 virtual void drawBackground( QPainter*, const QRectF& rect ) const;
129
130 private:
131 class PrivateData;
132 PrivateData* m_data;
133};
134
135#endif
Attributes of an entry on a legend.
Base class for items on the plot canvas.
virtual int rtti() const
A class which draws a legend inside the plot canvas.
BackgroundMode
Background mode.
@ LegendBackground
The legend has a background.
A scale map.