.Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
QCPlot::QCPAbstractLegendItem Class Referenceabstract

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

Inheritance diagram for QCPlot::QCPAbstractLegendItem:
QCPlot::QCPPlottableLegendItem

Signals

void 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.
 

Public Member Functions

 QCPAbstractLegendItem (QCPLegend *parent)
 Constructs a QCPAbstractLegendItem and associates it with the QCPLegend parent. More...
 
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)
 Sets whether this legend item is drawn antialiased or not. More...
 
void setFont (const QFont &font)
 Sets the default font of this specific legend item to font. More...
 
void setTextColor (const QColor &color)
 Sets the default text color of this specific legend item to color. More...
 
void 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. More...
 
void 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. More...
 
void setSelectable (bool selectable)
 Sets whether this specific legend item is selectable. More...
 
void setSelected (bool selected)
 Sets whether this specific legend item is selected. More...
 

Protected Member Functions

virtual void draw (QCPPainter *painter, const QRect &rect) const =0
 Draws this legend item with painter inside the specified rect. More...
 
virtual QSize size (const QSize &targetSize) const =0
 Returns the size this item occupies in the legend. More...
 
void applyAntialiasingHint (QCPPainter *painter) const
 

Protected Attributes

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

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:

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

QCPlot::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.

Member Function Documentation

void QCPlot::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 QCPlot::QCPPlottableLegendItem.

void QCPlot::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 QCPlot::QCPAbstractLegendItem::setFont ( const QFont &  font)

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

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

Sets whether this specific legend item is selectable.

See Also
setSelected, QCustomPlot::setInteractions
void QCPlot::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 QCPlot::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 QCPlot::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 QCPlot::QCPAbstractLegendItem::setTextColor ( const QColor &  color)

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

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


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