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 override
void setAlignmentInCanvas (Qt::Alignment)
Set the alignmnet. Qt::Alignment alignmentInCanvas () const
void setOffsetInCanvas (Qt::Orientations, int numPixels)
Set the distance between the legend and the canvas border. int
offsetInCanvas (Qt::Orientation) 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 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 *, const QwtScaleMap &xMap,
const QwtScaleMap &yMap, const QRectF &canvasRect) const
override
void clearLegend ()
Remove all items from the legend. virtual void updateLegend (const
QwtPlotItem *, const QList< QwtLegendData >
&) override
virtual QRect geometry (const QRectF &canvasRect) const
virtual QSize minimumSize (const QwtLegendData &) const
virtual int heightForWidth (const QwtLegendData &, int
width) const
QList< const QwtPlotItem * > plotItems () const
QList< QRect > legendGeometries (const QwtPlotItem
*) const
Protected Member Functions
virtual void drawLegendData (QPainter *, 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
Definition at line 41 of file qwt_plot_legenditem.h.
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.
Definition at line 54 of file qwt_plot_legenditem.h.
Member Function Documentation
Qt::Alignment QwtPlotLegendItem::alignmentInCanvas () const
Returns
See also
Definition at line 223 of file qwt_plot_legenditem.cpp.
QBrush QwtPlotLegendItem::backgroundBrush () const
Returns
See also
Definition at line 522 of file qwt_plot_legenditem.cpp.
QwtPlotLegendItem::BackgroundMode QwtPlotLegendItem::backgroundMode () const
Returns
See also
Definition at line 550 of file qwt_plot_legenditem.cpp.
QPen QwtPlotLegendItem::borderPen () const
Returns
See also
Definition at line 496 of file qwt_plot_legenditem.cpp.
double QwtPlotLegendItem::borderRadius () const
Returns
See also
Definition at line 472 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::draw (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & canvasRect) const [override], [virtual]
Draw the legend
Parameters
xMap x Scale Map
yMap y Scale Map
canvasRect Contents rectangle of the canvas in painter coordinates
Implements QwtPlotItem.
Definition at line 587 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::drawBackground (QPainter * painter, const QRectF & rect) const [protected], [virtual]
Draw a rounded rect
Parameters
rect Bounding rectangle
See also
Definition at line 630 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::drawLegendData (QPainter * painter, const QwtPlotItem * plotItem, const QwtLegendData & data, const QRectF & rect) const [protected], [virtual]
Draw an entry on the legend
Parameters
plotItem Plot item, represented by the entry
data Attributes of the legend entry
rect Bounding rectangle for the entry
Definition at line 780 of file qwt_plot_legenditem.cpp.
QFont QwtPlotLegendItem::font () const
Returns
See also
Definition at line 389 of file qwt_plot_legenditem.cpp.
QRect QwtPlotLegendItem::geometry (const QRectF & canvasRect) const [virtual]
Calculate the geometry of the legend on the canvas
Parameters
Returns
Definition at line 650 of file qwt_plot_legenditem.cpp.
int QwtPlotLegendItem::heightForWidth (const QwtLegendData & data, int width) const [virtual]
Returns
Parameters
width Width
Definition at line 862 of file qwt_plot_legenditem.cpp.
int QwtPlotLegendItem::itemMargin () const
Returns
See also
Definition at line 335 of file qwt_plot_legenditem.cpp.
int QwtPlotLegendItem::itemSpacing () const
Returns
See also
Definition at line 363 of file qwt_plot_legenditem.cpp.
QList< QRect > QwtPlotLegendItem::legendGeometries (const QwtPlotItem * plotItem) const
Returns
Note
Definition at line 895 of file qwt_plot_legenditem.cpp.
int QwtPlotLegendItem::margin () const
Returns
See also
Definition at line 280 of file qwt_plot_legenditem.cpp.
uint QwtPlotLegendItem::maxColumns () const
Returns
See also
Definition at line 251 of file qwt_plot_legenditem.cpp.
QSize QwtPlotLegendItem::minimumSize (const QwtLegendData & data) const [virtual]
Minimum size hint needed to display an entry
Parameters
Returns
Definition at line 823 of file qwt_plot_legenditem.cpp.
int QwtPlotLegendItem::offsetInCanvas (Qt::Orientation orientation) const
Parameters
Returns
See also
Definition at line 444 of file qwt_plot_legenditem.cpp.
QList< const QwtPlotItem * > QwtPlotLegendItem::plotItems () const
Returns
Note
Definition at line 886 of file qwt_plot_legenditem.cpp.
int QwtPlotLegendItem::rtti () const [override], [virtual]
Returns
Reimplemented from QwtPlotItem.
Definition at line 192 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setAlignmentInCanvas (Qt::Alignment alignment)
Set the alignmnet. Alignment means the position of the legend relative to the geometry of the plot canvas.
Parameters
See also
Note
Definition at line 210 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setBackgroundBrush (const QBrush & brush)
Set the background brush. The brush is used to fill the background
Parameters
See also
Definition at line 509 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setBackgroundMode (BackgroundMode mode)
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
Definition at line 537 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setBorderPen (const QPen & pen)
Set the pen for drawing the border
Parameters
See also
Definition at line 483 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setBorderRadius (double radius)
Set the radius for the border
Parameters
See also
Definition at line 457 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setFont (const QFont & font)
Change the font used for drawing the text label
Parameters
See also
Definition at line 374 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setItemMargin (int margin)
Set the margin around each item
Parameters
See also
Definition at line 319 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setItemSpacing (int spacing)
Set the spacing inside of each item
Parameters
See also
Definition at line 346 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setMargin (int margin)
Set the margin around legend items. The default setting for the margin is 0.
Parameters
See also
Definition at line 264 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setMaxColumns (uint maxColumns)
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
Definition at line 238 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setOffsetInCanvas (Qt::Orientations orientations, int numPixels)
Set the distance between the legend and the canvas border. The default setting is 10 pixels.
Parameters
numPixels Distance in pixels
See also
Definition at line 405 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setSpacing (int spacing)
Set the spacing between the legend items.
Parameters
See also
Definition at line 294 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::setTextPen (const QPen & pen)
Set the pen for drawing text labels.
Parameters
See also
Definition at line 561 of file qwt_plot_legenditem.cpp.
int QwtPlotLegendItem::spacing () const
Returns
See also
Definition at line 308 of file qwt_plot_legenditem.cpp.
QPen QwtPlotLegendItem::textPen () const
Returns
See also
Definition at line 574 of file qwt_plot_legenditem.cpp.
void QwtPlotLegendItem::updateLegend (const QwtPlotItem * plotItem, const QList< QwtLegendData > & data) [override], [virtual]
Update the legend items according to modifications of a plot item
Parameters
data Attributes of the legend entries
Reimplemented from QwtPlotItem.
Definition at line 697 of file qwt_plot_legenditem.cpp.
Author
Generated automatically by Doxygen for Qwt User's Guide from the source code.
Sun Jul 18 2021 | Version 6.2.0 |