QwtPlotLegendItem(3) | Qwt User's Guide | QwtPlotLegendItem(3) |
NAME¶
QwtPlotLegendItem -A class which draws a legend inside the plot canvas.
SYNOPSIS¶
#include <qwt_plot_legenditem.h>
Inherits QwtPlotItem.
Public Types¶
enum BackgroundMode { LegendBackground, ItemBackground }
Background mode.
Public Member Functions¶
QwtPlotLegendItem ()
Constructor. virtual ~QwtPlotLegendItem ()
Destructor. virtual int rtti () const
void setAlignment (Qt::Alignment)
Set the alignmnet. Qt::Alignment alignment () const
void setMaxColumns (uint)
Limit the number of columns. uint maxColumns () const
void setMargin (int)
Set the margin around legend items. int margin () const
void setSpacing (int)
Set the spacing between the legend items. int spacing () const
void setItemMargin (int)
int itemMargin () const
void setItemSpacing (int)
int itemSpacing () const
void setFont (const QFont &)
QFont font () const
void setBorderDistance (int numPixels)
Set the margin between the legend and the canvas border. int borderDistance () const
void setBorderRadius (double)
double borderRadius () const
void setBorderPen (const QPen &)
QPen borderPen () const
void setBackgroundBrush (const QBrush &)
Set the background brush. QBrush backgroundBrush () const
void setBackgroundMode (BackgroundMode)
Set the background mode. BackgroundMode backgroundMode () const
void setTextPen (const QPen &)
Set the pen for drawing text labels. QPen textPen () const
virtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &rect) const
void clearLegend ()
Remove all items from the legend. virtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &)
virtual QRect geometry (const QRectF &canvasRect) const
virtual QSize minimumSize (const QwtLegendData &) const
virtual int heightForWidth (const QwtLegendData &, int w) const
QList< const QwtPlotItem * > plotItems () const
QList< QRect > legendGeometries (const QwtPlotItem *) const
Protected Member Functions¶
virtual void drawLegendData (QPainter *painter, const QwtPlotItem *, const QwtLegendData &, const QRectF &) const
virtual void drawBackground (QPainter *, const QRectF &rect) const
Detailed Description¶
A class which draws a legend inside the plot canvas.QwtPlotLegendItem can be used to draw a inside the plot canvas. It can be used together with a QwtLegend or instead of it to have more space for the plot canvas.
In opposite to QwtLegend the legend item is not interactive. To identify mouse clicks on a legend item an event filter needs to be installed catching mouse events ob the plot canvas. The geometries of the legend items are available using legendGeometries().
The legend item is aligned to plot canvas according to its alignment() flags. It might have a background for the complete legend ( usually semi transparent ) or for each legend item.
Note:
Member Enumeration Documentation¶
enum QwtPlotLegendItem::BackgroundMode¶
Background mode. Depending on the mode the complete legend or each item might have an background.The default setting is LegendBackground.
See Also:
Enumerator
- LegendBackground
- The legend has a background.
- ItemBackground
- Each item has a background.
Member Function Documentation¶
Qt::Alignment QwtPlotLegendItem::alignment () const¶
Returns:See Also:
QBrush QwtPlotLegendItem::backgroundBrush () const¶
Returns:See Also:
QwtPlotLegendItem::BackgroundMode QwtPlotLegendItem::backgroundMode () const¶
Returns:See Also:
int QwtPlotLegendItem::borderDistance () const¶
Returns:See Also:
QPen QwtPlotLegendItem::borderPen () const¶
Returns:See Also:
double QwtPlotLegendItem::borderRadius () const¶
Returns:See Also:
void QwtPlotLegendItem::draw (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const [virtual]¶
Draw the legendParameters:
xMap x Scale Map
yMap y Scale Map
canvasRect Contents rectangle of the canvas in painter coordinates
Implements QwtPlotItem.
void QwtPlotLegendItem::drawBackground (QPainter *painter, const QRectF &rect) const [protected], [virtual]¶
Draw a rounded rectParameters:
rect Bounding rectangle
See Also:
void QwtPlotLegendItem::drawLegendData (QPainter *painter, const QwtPlotItem *plotItem, const QwtLegendData &data, const QRectF &rect) const [protected], [virtual]¶
Draw an entry on the legendParameters:
plotItem Plot item, represented by the entry
data Attributes of the legend entry
rect Bounding rectangle for the entry
QFont QwtPlotLegendItem::font () const¶
Returns:See Also:
QRect QwtPlotLegendItem::geometry (const QRectF &canvasRect) const [virtual]¶
Calculate the geometry of the legend on the canvasParameters:
Returns:
int QwtPlotLegendItem::heightForWidth (const QwtLegendData &data, intwidth) const [virtual]¶
Returns:Parameters:
width Width
int QwtPlotLegendItem::itemMargin () const¶
Returns:See Also:
int QwtPlotLegendItem::itemSpacing () const¶
Returns:See Also:
QList< QRect > QwtPlotLegendItem::legendGeometries (const QwtPlotItem *plotItem) const¶
Returns:Note:
int QwtPlotLegendItem::margin () const¶
Returns:See Also:
uint QwtPlotLegendItem::maxColumns () const¶
Returns:See Also:
QSize QwtPlotLegendItem::minimumSize (const QwtLegendData &data) const [virtual]¶
Minimum size hint needed to display an entryParameters:
Returns:
QList< const QwtPlotItem * > QwtPlotLegendItem::plotItems () const¶
Returns:Note:
int QwtPlotLegendItem::rtti () const [virtual]¶
Returns:Reimplemented from QwtPlotItem.
void QwtPlotLegendItem::setAlignment (Qt::Alignmentalignment)¶
Set the alignmnet. Alignment means the position of the legend relative to the geometry of the plot canvas.Parameters:
See Also:
Note:
void QwtPlotLegendItem::setBackgroundBrush (const QBrush &brush)¶
Set the background brush. The brush is used to fill the backgroundParameters:
See Also:
void QwtPlotLegendItem::setBackgroundMode (BackgroundModemode)¶
Set the background mode. Depending on the mode the complete legend or each item might have an background.The default setting is LegendBackground.
See Also:
void QwtPlotLegendItem::setBorderDistance (intdistance)¶
Set the margin between the legend and the canvas border. The default setting for the margin is 10 pixels.Parameters:
See Also:
void QwtPlotLegendItem::setBorderPen (const QPen &pen)¶
Set the pen for drawing the borderParameters:
See Also:
void QwtPlotLegendItem::setBorderRadius (doubleradius)¶
Set the radius for the borderParameters:
See Also:
void QwtPlotLegendItem::setFont (const QFont &font)¶
Change the font used for drawing the text labelParameters:
See Also:
void QwtPlotLegendItem::setItemMargin (intmargin)¶
Set the margin around each itemParameters:
See Also:
void QwtPlotLegendItem::setItemSpacing (intspacing)¶
Set the spacing inside of each itemParameters:
See Also:
void QwtPlotLegendItem::setMargin (intmargin)¶
Set the margin around legend items. The default setting for the margin is 0.Parameters:
See Also:
void QwtPlotLegendItem::setMaxColumns (uintmaxColumns)¶
Limit the number of columns. When aligning the legend horizontally ( Qt::AlignLeft, Qt::AlignRight ) the number of columns needs to be limited to avoid, that the width of the legend grows with an increasing number of entries.Parameters:
See Also:
void QwtPlotLegendItem::setSpacing (intspacing)¶
Set the spacing between the legend items.Parameters:
See Also:
void QwtPlotLegendItem::setTextPen (const QPen &pen)¶
Set the pen for drawing text labels.Parameters:
See Also:
int QwtPlotLegendItem::spacing () const¶
Returns:See Also:
QPen QwtPlotLegendItem::textPen () const¶
Returns:See Also:
void QwtPlotLegendItem::updateLegend (const QwtPlotItem *plotItem, const QList< QwtLegendData > &data) [virtual]¶
Update the legend items according to modifications of a plot itemParameters:
data Attributes of the legend entries
Reimplemented from QwtPlotItem.
Author¶
Generated automatically by Doxygen for Qwt User's Guide from the source code.Thu Dec 11 2014 | Version 6.1.2 |