QCPPlottableLegendItem
Public Member Functions | |
QCPPlottableLegendItem (QCPLegend *parent, QCPAbstractPlottable *plottable) | |
QCPAbstractPlottable * | plottable () |
Public Member Functions inherited from QCPAbstractLegendItem | |
QCPAbstractLegendItem (QCPLegend *parent) | |
QFont | font () const |
QCPLegend * | parentLegend () const |
bool | selectable () const |
bool | selected () const |
QFont | selectedFont () const |
QColor | selectedTextColor () const |
virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=nullptr) const override |
void | setFont (const QFont &font) |
Q_SLOT void | setSelectable (bool selectable) |
Q_SLOT void | setSelected (bool selected) |
void | setSelectedFont (const QFont &font) |
void | setSelectedTextColor (const QColor &color) |
void | setTextColor (const QColor &color) |
QColor | textColor () const |
Public Member Functions inherited from QCPLayoutElement | |
QCPLayoutElement (QCustomPlot *parentPlot=nullptr) | |
QCP::MarginSides | autoMargins () const |
virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
QCPLayout * | layout () const |
QCPMarginGroup * | marginGroup (QCP::MarginSide side) const |
QHash< QCP::MarginSide, QCPMarginGroup * > | marginGroups () const |
QMargins | margins () const |
virtual QSize | maximumOuterSizeHint () const |
QSize | maximumSize () const |
QMargins | minimumMargins () const |
QSize | minimumSize () const |
QRect | outerRect () const |
QRect | rect () const |
void | setAutoMargins (QCP::MarginSides sides) |
void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
void | setMargins (const QMargins &margins) |
void | setMaximumSize (const QSize &size) |
void | setMaximumSize (int width, int height) |
void | setMinimumMargins (const QMargins &margins) |
void | setMinimumSize (const QSize &size) |
void | setMinimumSize (int width, int height) |
void | setOuterRect (const QRect &rect) |
void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
SizeConstraintRect | sizeConstraintRect () const |
virtual void | update (UpdatePhase phase) |
Public Member Functions inherited from QCPLayerable | |
QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=nullptr) | |
bool | antialiased () const |
QCPLayer * | layer () const |
QCPLayerable * | parentLayerable () const |
QCustomPlot * | parentPlot () const |
bool | realVisibility () const |
void | setAntialiased (bool enabled) |
bool | setLayer (const QString &layerName) |
Q_SLOT bool | setLayer (QCPLayer *layer) |
void | setVisible (bool on) |
bool | visible () const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QBindable< QString > | bindableObjectName () |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () const const |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isQuickItemType () const const |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_GADGET_EXPORT (EXPORT_MACRO) | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_MOC_INCLUDE Q_MOC_INCLUDE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setObjectName (QAnyStringView name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | setProperty (const char *name, QVariant &&value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType) |
QThread * | thread () const const |
Protected Member Functions | |
virtual void | draw (QCPPainter *painter) override |
QFont | getFont () const |
QPen | getIconBorderPen () const |
QColor | getTextColor () const |
virtual QSize | minimumOuterSizeHint () const override |
Protected Member Functions inherited from QCPAbstractLegendItem | |
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const override |
virtual QRect | clipRect () const override |
virtual void | deselectEvent (bool *selectionStateChanged) override |
virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) override |
virtual QCP::Interaction | selectionCategory () const override |
Protected Member Functions inherited from QCPLayoutElement | |
virtual int | calculateAutoMargin (QCP::MarginSide side) |
virtual void | layoutChanged () |
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) override |
Protected Member Functions inherited from QCPLayerable | |
void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
void | initializeParentPlot (QCustomPlot *parentPlot) |
virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
bool | moveToLayer (QCPLayer *layer, bool prepend) |
void | setParentLayerable (QCPLayerable *parentLayerable) |
virtual void | wheelEvent (QWheelEvent *event) |
Protected Member Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Protected Attributes | |
QCPAbstractPlottable * | mPlottable |
Protected Attributes inherited from QCPAbstractLegendItem | |
QFont | mFont |
QCPLegend * | mParentLegend |
bool | mSelectable |
bool | mSelected |
QFont | mSelectedFont |
QColor | mSelectedTextColor |
QColor | mTextColor |
Protected Attributes inherited from QCPLayoutElement | |
QCP::MarginSides | mAutoMargins |
QHash< QCP::MarginSide, QCPMarginGroup * > | mMarginGroups |
QMargins | mMargins |
QSize | mMaximumSize |
QMargins | mMinimumMargins |
QSize | mMinimumSize |
QRect | mOuterRect |
QCPLayout * | mParentLayout |
QRect | mRect |
SizeConstraintRect | mSizeConstraintRect |
Protected Attributes inherited from QCPLayerable | |
bool | mAntialiased |
QCPLayer * | mLayer |
QPointer< QCPLayerable > | mParentLayerable |
QCustomPlot * | mParentPlot |
bool | mVisible |
Additional Inherited Members | |
Public Types inherited from QCPLayoutElement | |
enum | SizeConstraintRect { scrInnerRect , scrOuterRect } |
enum | UpdatePhase { upPreparation , upMargins , upLayout } |
Public Types inherited from QObject | |
typedef | QObjectList |
Properties inherited from QObject | |
objectName | |
Signals inherited from QCPAbstractLegendItem | |
void | selectableChanged (bool selectable) |
void | selectionChanged (bool selected) |
Signals inherited from QCPLayerable | |
void | layerChanged (QCPLayer *newLayer) |
Static Public Member Functions inherited from QObject | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
Detailed Description
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.
Definition at line 5114 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPPlottableLegendItem()
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 18928 of file qcustomplot.cpp.
Member Function Documentation
◆ draw()
|
overrideprotectedvirtual |
Draws the item with painter. The size and position of the drawn legend item is defined by the parent layout (typically a QCPLegend) and the minimumOuterSizeHint and maximumOuterSizeHint of this legend item.
Implements QCPAbstractLegendItem.
Definition at line 18971 of file qcustomplot.cpp.
◆ getFont()
|
protected |
Returns the font that shall be used to draw text, taking into account the selection state of this item.
Definition at line 18960 of file qcustomplot.cpp.
◆ getIconBorderPen()
|
protected |
Returns the pen that shall be used to draw the icon border, taking into account the selection state of this item.
Definition at line 18940 of file qcustomplot.cpp.
◆ getTextColor()
|
protected |
Returns the text color that shall be used to draw text, taking into account the selection state of this item.
Definition at line 18950 of file qcustomplot.cpp.
◆ minimumOuterSizeHint()
|
overrideprotectedvirtual |
Calculates and returns the size of this item. This includes the icon, the text and the padding in between.
\seebaseclassmethod
Reimplemented from QCPLayoutElement.
Definition at line 19004 of file qcustomplot.cpp.
◆ plottable()
|
inline |
Definition at line 5121 of file qcustomplot.h.
Member Data Documentation
◆ mPlottable
|
protected |
Definition at line 5125 of file qcustomplot.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.