rock_widget_collection  0.1
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
QCPAbstractLegendItem Class Referenceabstract

The abstract base class for all items in a QCPLegend. More...

#include <qcustomplot.h>

Inherited by QCPPlottableLegendItem.

Public Member Functions

 QCPAbstractLegendItem (QCPLegend *parent)
 
virtual ~QCPAbstractLegendItem ()
 
QFont font () const
 
void setFont (const QFont &font)
 

Protected Member Functions

virtual void draw (QPainter *painter, const QRect &rect) const =0
 
virtual QSize size (const QSize &targetSize) const =0
 

Protected Attributes

QCPLegendmParentLegend
 
QFont mFont
 

Friends

class QCPLegend
 

Detailed Description

The abstract base class for all items in a QCPLegend.

It defines a very basic interface to items in a QCPLegend. For representing plottables in the legend, the subclass QCPPlottableLegendItem is more suitable.

Only derive directly from this class when you need absolute freedom (i.e. a legend item that's not associated with a plottable).

You must implement the following pure virtual functions:

You inherit the following members you may use:

Definition at line 512 of file qcustomplot.h.

Constructor & Destructor Documentation

QCPAbstractLegendItem::QCPAbstractLegendItem ( QCPLegend parent)

Constructs a QCPAbstractLegendItem and associates it with the QCPLegend parent. This does not cause the item to be added to parent, so QCPLegend::addItem must be called separately.

Definition at line 6368 of file qcustomplot.cc.

6368  :
6369  mParentLegend(parent),
6370  mFont(parent->font())
6371 {
6372 }
QFont font() const
Definition: qcustomplot.h:580
QCPLegend * mParentLegend
Definition: qcustomplot.h:524
virtual QCPAbstractLegendItem::~QCPAbstractLegendItem ( )
inlinevirtual

Definition at line 516 of file qcustomplot.h.

516 {}

Member Function Documentation

void QCPAbstractLegendItem::draw ( QPainter *  painter,
const QRect &  rect 
) const
protectedpure virtual

Draws this legend item with painter inside the specified rect. The rect typically has the size which was returned from a preceding size call.

Implemented in QCPPlottableLegendItem.

QFont QCPAbstractLegendItem::font ( ) const
inline

Definition at line 519 of file qcustomplot.h.

519 { return mFont; }
void QCPAbstractLegendItem::setFont ( const QFont &  font)

Sets the default font of this specific legend item to font.

See Also
QCPLegend::setFont

Definition at line 6379 of file qcustomplot.cc.

6380 {
6381  mFont = font;
6382 }
QFont font() const
Definition: qcustomplot.h:519
QSize QCPAbstractLegendItem::size ( const QSize &  targetSize) const
protectedpure virtual

Returns the size this item occupies in the legend. The legend will adapt its layout with the help of this function. If this legend item can have a variable width (e.g. auto-wrapping text), this function tries to find a size with a width close to the width of targetSize. The height of targetSize only may have meaning in specific sublasses. Typically, it's ignored.

Implemented in QCPPlottableLegendItem.

Friends And Related Function Documentation

friend class QCPLegend
friend

Definition at line 530 of file qcustomplot.h.

Member Data Documentation

QFont QCPAbstractLegendItem::mFont
protected

Definition at line 525 of file qcustomplot.h.

QCPLegend* QCPAbstractLegendItem::mParentLegend
protected

Definition at line 524 of file qcustomplot.h.


The documentation for this class was generated from the following files: