![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
A legend item representing a plottable with an icon and the plottable name. More...
#include <qcustomplot.h>


Public Member Functions | |
| QCPPlottableLegendItem (QCPLegend *parent, QCPAbstractPlottable *plottable) | |
| QCPAbstractPlottable * | plottable () |
| QCPPlottableLegendItem (QCPLegend *parent, QCPAbstractPlottable *plottable) | |
| QCPAbstractPlottable * | plottable () |
Public Member Functions inherited from QCPAbstractLegendItem | |
| QCPAbstractLegendItem (QCPLegend *parent) | |
| QCPLegend * | parentLegend () const |
| QFont | font () const |
| QColor | textColor () const |
| QFont | selectedFont () const |
| QColor | selectedTextColor () const |
| bool | selectable () const |
| bool | selected () const |
| void | setFont (const QFont &font) |
| void | setTextColor (const QColor &color) |
| void | setSelectedFont (const QFont &font) |
| void | setSelectedTextColor (const QColor &color) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| QCPAbstractLegendItem (QCPLegend *parent) | |
| QCPLegend * | parentLegend () const |
| QFont | font () const |
| QColor | textColor () const |
| QFont | selectedFont () const |
| QColor | selectedTextColor () const |
| bool | selectable () const |
| bool | selected () const |
| void | setFont (const QFont &font) |
| void | setTextColor (const QColor &color) |
| void | setSelectedFont (const QFont &font) |
| void | setSelectedTextColor (const QColor &color) |
| Q_SLOT void | setSelectable (bool selectable) |
| Q_SLOT void | setSelected (bool selected) |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
Public Member Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| virtual | ~QCPLayoutElement () |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| QMargins | margins () const |
| QMargins | minimumMargins () const |
| QCP::MarginSides | autoMargins () const |
| QSize | minimumSize () const |
| QSize | maximumSize () const |
| SizeConstraintRect | sizeConstraintRect () const |
| QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual void | update (UpdatePhase phase) |
| virtual QSize | maximumOuterSizeHint () const |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| virtual | ~QCPLayoutElement () |
| QCPLayout * | layout () const |
| QRect | rect () const |
| QRect | outerRect () const |
| QMargins | margins () const |
| QMargins | minimumMargins () const |
| QCP::MarginSides | autoMargins () const |
| QSize | minimumSize () const |
| QSize | maximumSize () const |
| QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
| QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
| void | setOuterRect (const QRect &rect) |
| void | setMargins (const QMargins &margins) |
| void | setMinimumMargins (const QMargins &margins) |
| void | setAutoMargins (QCP::MarginSides sides) |
| void | setMinimumSize (const QSize &size) |
| void | setMinimumSize (int width, int height) |
| void | setMaximumSize (const QSize &size) |
| void | setMaximumSize (int width, int height) |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| virtual void | update (UpdatePhase phase) |
| virtual QSize | maximumSizeHint () const |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
Public Member Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| virtual | ~QCPLayerable () |
| bool | visible () const |
| QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| QCPLayer * | layer () const |
| bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| ~QCPLayerable () | |
| bool | visible () const |
| QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| QCPLayer * | layer () const |
| bool | antialiased () const |
| void | setVisible (bool on) |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| bool | setLayer (const QString &layerName) |
| void | setAntialiased (bool enabled) |
| bool | realVisibility () const |
Protected Member Functions | |
| virtual void | draw (QCPPainter *painter) |
| virtual QSize | minimumOuterSizeHint () const |
| QPen | getIconBorderPen () const |
| QColor | getTextColor () const |
| QFont | getFont () const |
| virtual void | draw (QCPPainter *painter) |
| virtual QSize | minimumSizeHint () const |
| QPen | getIconBorderPen () const |
| QColor | getTextColor () const |
| QFont | getFont () const |
Protected Member Functions inherited from QCPAbstractLegendItem | |
| virtual QCP::Interaction | selectionCategory () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual QCP::Interaction | selectionCategory () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const |
| virtual QRect | clipRect () const |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
Protected Member Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | mousePressEvent (QMouseEvent *event) |
| virtual void | mouseMoveEvent (QMouseEvent *event) |
| virtual void | mouseReleaseEvent (QMouseEvent *event) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
| virtual void | wheelEvent (QWheelEvent *event) |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
Protected Member Functions inherited from QCPLayerable | |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
| void | initializeParentPlot (QCustomPlot *parentPlot) |
| void | setParentLayerable (QCPLayerable *parentLayerable) |
| bool | moveToLayer (QCPLayer *layer, bool prepend) |
| void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
Protected Attributes | |
| QCPAbstractPlottable * | mPlottable |
Protected Attributes inherited from QCPAbstractLegendItem | |
| QCPLegend * | mParentLegend |
| QFont | mFont |
| QColor | mTextColor |
| QFont | mSelectedFont |
| QColor | mSelectedTextColor |
| bool | mSelectable |
| bool | mSelected |
Protected Attributes inherited from QCPLayoutElement | |
| QCPLayout * | mParentLayout |
| QSize | mMinimumSize |
| QSize | mMaximumSize |
| SizeConstraintRect | mSizeConstraintRect |
| QRect | mRect |
| QRect | mOuterRect |
| QMargins | mMargins |
| QMargins | mMinimumMargins |
| QCP::MarginSides | mAutoMargins |
| QHash< QCP::MarginSide, QCPMarginGroup * > | mMarginGroups |
Protected Attributes inherited from QCPLayerable | |
| bool | mVisible |
| QCustomPlot * | mParentPlot |
| QPointer< QCPLayerable > | mParentLayerable |
| QCPLayer * | mLayer |
| bool | mAntialiased |
Additional Inherited Members | |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase { upPreparation , upMargins , upLayout , upPreparation , upMargins , upLayout } |
| enum | SizeConstraintRect { scrInnerRect , scrOuterRect } |
| enum | UpdatePhase { upPreparation , upMargins , upLayout , upPreparation , upMargins , upLayout } |
Signals inherited from QCPAbstractLegendItem | |
| void | selectionChanged (bool selected) |
| void | selectableChanged (bool selectable) |
| void | selectionChanged (bool selected) |
| void | selectableChanged (bool selectable) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
| void | layerChanged (QCPLayer *newLayer) |
A legend item representing a plottable with an icon and the plottable name.
This is the standard legend item for plottables. It displays an icon of the plottable next to the plottable name. The icon is drawn by the respective plottable itself (QCPAbstractPlottable::drawLegendIcon), and tries to give an intuitive symbol for the plottable. For example, the QCPGraph draws a centered horizontal line and/or a single scatter point in the middle.
Legend items of this type are always associated with one plottable (retrievable via the plottable() function and settable with the constructor). You may change the font of the plottable name with setFont. Icon padding and border pen is taken from the parent QCPLegend, see QCPLegend::setIconBorderPen and QCPLegend::setIconTextPadding.
The function QCPAbstractPlottable::addToLegend/ QCPAbstractPlottable::removeFromLegend creates/removes legend items of this type.
Since QCPLegend is based on QCPLayoutGrid, a legend item itself is just a subclass of QCPLayoutElement. While it could be added to a legend (or any other layout) via the normal layout interface, QCPLegend has specialized functions for handling legend items conveniently, see the documentation of QCPLegend.
This is the standard legend item for plottables. It displays an icon of the plottable next to the plottable name. The icon is drawn by the respective plottable itself (QCPAbstractPlottable::drawLegendIcon), and tries to give an intuitive symbol for the plottable. For example, the QCPGraph draws a centered horizontal line and/or a single scatter point in the middle.
Legend items of this type are always associated with one plottable (retrievable via the plottable() function and settable with the constructor). You may change the font of the plottable name with setFont. Icon padding and border pen is taken from the parent QCPLegend, see QCPLegend::setIconBorderPen and QCPLegend::setIconTextPadding.
The function QCPAbstractPlottable::addToLegend/ QCPAbstractPlottable::removeFromLegend creates/removes legend items of this type in the default implementation. However, these functions may be reimplemented such that a different kind of legend item (e.g a direct subclass of QCPAbstractLegendItem) is used for that plottable.
Since QCPLegend is based on QCPLayoutGrid, a legend item itself is just a subclass of QCPLayoutElement. While it could be added to a legend (or any other layout) via the normal layout interface, QCPLegend has specialized functions for handling legend items conveniently, see the documentation of QCPLegend.
Definition at line 5583 of file qcustomplot.h.
| QCPPlottableLegendItem::QCPPlottableLegendItem | ( | QCPLegend * | parent, |
| QCPAbstractPlottable * | plottable | ||
| ) |
Creates a new legend item associated with plottable.
Once it's created, it can be added to the legend via QCPLegend::addItem.
A more convenient way of adding/removing a plottable to/from the legend is via the functions QCPAbstractPlottable::addToLegend and QCPAbstractPlottable::removeFromLegend.
Definition at line 18884 of file qcustomplot.cpp.
References QCPLayerable::setAntialiased().
| QCPPlottableLegendItem::QCPPlottableLegendItem | ( | QCPLegend * | parent, |
| QCPAbstractPlottable * | plottable | ||
| ) |
|
protectedvirtual |
Implements QCPAbstractLegendItem.
Definition at line 18924 of file qcustomplot.cpp.
References QCPAbstractPlottable::drawLegendIcon(), getFont(), getIconBorderPen(), getTextColor(), QCPLegend::iconSize(), QCPLegend::iconTextPadding(), QCPLayoutElement::mOuterRect, QCPAbstractLegendItem::mParentLegend, mPlottable, QCPLayoutElement::mRect, QCPAbstractPlottable::name(), QCPPainter::restore(), QCPPainter::save(), and QCPPainter::setPen().
|
protectedvirtual |
Implements QCPAbstractLegendItem.
|
protected |
Definition at line 18914 of file qcustomplot.cpp.
References QCPAbstractLegendItem::mFont, QCPAbstractLegendItem::mSelected, and QCPAbstractLegendItem::mSelectedFont.
Referenced by draw(), minimumOuterSizeHint(), and minimumSizeHint().
|
protected |
|
protected |
Definition at line 18895 of file qcustomplot.cpp.
References QCPLegend::iconBorderPen(), QCPAbstractLegendItem::mParentLegend, QCPAbstractLegendItem::mSelected, and QCPLegend::selectedIconBorderPen().
Referenced by draw().
|
protected |
|
protected |
Definition at line 18905 of file qcustomplot.cpp.
References QCPAbstractLegendItem::mSelected, QCPAbstractLegendItem::mSelectedTextColor, and QCPAbstractLegendItem::mTextColor.
Referenced by draw().
|
protected |
|
protectedvirtual |
Returns the suggested minimum size this layout element (the outerRect) may be compressed to, if no manual minimum size is set.
if a minimum size (setMinimumSize) was not set manually, parent layouts use the returned size (usually indirectly through QCPLayout::getFinalMinimumOuterSize) to determine the minimum allowed size of this layout element.
A manual minimum size is considered set if it is non-zero.
The default implementation simply returns the sum of the horizontal margins for the width and the sum of the vertical margins for the height. Reimplementations may use their detailed knowledge about the layout element's content to provide size hints.
Reimplemented from QCPLayoutElement.
Definition at line 18966 of file qcustomplot.cpp.
References getFont(), QCPLegend::iconSize(), QCPLegend::iconTextPadding(), QCPLayoutElement::mMargins, QCPAbstractLegendItem::mParentLegend, mPlottable, QCPAbstractPlottable::name(), and result.
|
protectedvirtual |
Returns the minimum size this layout element (the inner rect) may be compressed to.
if a minimum size (setMinimumSize) was not set manually, parent layouts consult this function to determine the minimum allowed size of this layout element. (A manual minimum size is considered set if it is non-zero.)
Reimplemented from QCPLayoutElement.
Definition at line 13310 of file qcustomplot.cpp.
References getFont(), QCPLegend::iconSize(), QCPLegend::iconTextPadding(), QCPLayoutElement::mMargins, QCPAbstractLegendItem::mParentLegend, mPlottable, QCPAbstractPlottable::name(), and result.
|
inline |
Definition at line 5589 of file qcustomplot.h.
|
inline |
Definition at line 2619 of file qcustomplot.h.
|
protected |
Definition at line 5593 of file qcustomplot.h.
Referenced by draw(), minimumOuterSizeHint(), and minimumSizeHint().