Aquila  2.0 prealpha
Cognitive Robotics Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Signals | 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 <plot2d.h>

Inheritance diagram for QCPAbstractLegendItem:


void selectionChanged (bool selected)

Public Member Functions

 QCPAbstractLegendItem (QCPLegend *parent)
virtual ~QCPAbstractLegendItem ()
bool antialiased () const
QFont font () const
QColor textColor () const
QFont selectedFont () const
QColor selectedTextColor () const
bool selectable () const
bool selected () const
void setAntialiased (bool enabled)
void setFont (const QFont &font)
void setTextColor (const QColor &color)
void setSelectedFont (const QFont &font)
void setSelectedTextColor (const QColor &color)
void setSelectable (bool selectable)
void setSelected (bool selected)

Protected Member Functions

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

Protected Attributes

bool mAntialiased
QFont mFont
QColor mTextColor
QFont mSelectedFont
QColor mSelectedTextColor
bool mSelectable
bool mSelected


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:

QCPLegend *mParentLegend A pointer to the parent QCPLegend.
QFont mFont The generic font of the item. You should use this font for all or at least the most prominent text of the item.

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.

virtual QCPAbstractLegendItem::~QCPAbstractLegendItem ( )

Member Function Documentation

bool QCPAbstractLegendItem::antialiased ( ) const
void QCPAbstractLegendItem::applyAntialiasingHint ( QCPPainter painter) const
void QCPAbstractLegendItem::draw ( QCPPainter 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
bool QCPAbstractLegendItem::selectable ( ) const
bool QCPAbstractLegendItem::selected ( ) const
QFont QCPAbstractLegendItem::selectedFont ( ) const
QColor QCPAbstractLegendItem::selectedTextColor ( ) const
void QCPAbstractLegendItem::selectionChanged ( bool  selected)

This signal is emitted when the selection state of this legend item has changed, either by user interaction or by a direct call to setSelected.

void QCPAbstractLegendItem::setAntialiased ( bool  enabled)

Sets whether this legend item is drawn antialiased or not.

Note that this setting may be overridden by QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements.

void QCPAbstractLegendItem::setFont ( const QFont &  font)

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

See Also
setTextColor, QCPLegend::setFont
void QCPAbstractLegendItem::setSelectable ( bool  selectable)

Sets whether this specific legend item is selectable.

See Also
setSelected, QCustomPlot::setInteractions
void QCPAbstractLegendItem::setSelected ( bool  selected)

Sets whether this specific legend item is selected. The selection state of the parent QCPLegend is updated correspondingly.

It is possible to set the selection state of this item by calling this function directly, even if setSelectable is set to false.

See Also
setSelectable, QCustomPlot::setInteractions
void QCPAbstractLegendItem::setSelectedFont ( const QFont &  font)

When this legend item is selected, font is used to draw generic text, instead of the normal font set with setFont.

See Also
setFont, QCPLegend::setSelectedFont
void QCPAbstractLegendItem::setSelectedTextColor ( const QColor &  color)

When this legend item is selected, color is used to draw generic text, instead of the normal color set with setTextColor.

See Also
setTextColor, QCPLegend::setSelectedTextColor
void QCPAbstractLegendItem::setTextColor ( const QColor &  color)

Sets the default text color of this specific legend item to color.

See Also
setFont, QCPLegend::setTextColor
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.

QColor QCPAbstractLegendItem::textColor ( ) const

Friends And Related Function Documentation

friend class QCPLegend

Member Data Documentation

bool QCPAbstractLegendItem::mAntialiased
QFont QCPAbstractLegendItem::mFont
QCPLegend* QCPAbstractLegendItem::mParentLegend
bool QCPAbstractLegendItem::mSelectable
bool QCPAbstractLegendItem::mSelected
QFont QCPAbstractLegendItem::mSelectedFont
QColor QCPAbstractLegendItem::mSelectedTextColor
QColor QCPAbstractLegendItem::mTextColor

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