|
| QCPLegend () |
|
virtual | ~QCPLegend () |
|
QPen | borderPen () const |
|
QBrush | brush () const |
|
QFont | font () const |
|
QColor | textColor () const |
|
QSize | iconSize () const |
|
int | iconTextPadding () const |
|
QPen | iconBorderPen () const |
|
SelectableParts | selectableParts () const |
|
SelectableParts | selectedParts () const |
|
QPen | selectedBorderPen () const |
|
QPen | selectedIconBorderPen () const |
|
QBrush | selectedBrush () const |
|
QFont | selectedFont () const |
|
QColor | selectedTextColor () const |
|
void | setBorderPen (const QPen &pen) |
|
void | setBrush (const QBrush &brush) |
|
void | setFont (const QFont &font) |
|
void | setTextColor (const QColor &color) |
|
void | setIconSize (const QSize &size) |
|
void | setIconSize (int width, int height) |
|
void | setIconTextPadding (int padding) |
|
void | setIconBorderPen (const QPen &pen) |
|
Q_SLOT void | setSelectableParts (const SelectableParts &selectableParts) |
|
Q_SLOT void | setSelectedParts (const SelectableParts &selectedParts) |
|
void | setSelectedBorderPen (const QPen &pen) |
|
void | setSelectedIconBorderPen (const QPen &pen) |
|
void | setSelectedBrush (const QBrush &brush) |
|
void | setSelectedFont (const QFont &font) |
|
void | setSelectedTextColor (const QColor &color) |
|
virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE |
|
QCPAbstractLegendItem * | item (int index) const |
|
QCPPlottableLegendItem * | itemWithPlottable (const QCPAbstractPlottable *plottable) const |
|
int | itemCount () const |
|
bool | hasItem (QCPAbstractLegendItem *item) const |
|
bool | hasItemWithPlottable (const QCPAbstractPlottable *plottable) const |
|
bool | addItem (QCPAbstractLegendItem *item) |
|
bool | removeItem (int index) |
|
bool | removeItem (QCPAbstractLegendItem *item) |
|
void | clearItems () |
|
QList< QCPAbstractLegendItem * > | selectedItems () const |
|
| QCPLayoutGrid () |
|
virtual | ~QCPLayoutGrid () |
|
int | rowCount () const |
|
int | columnCount () const |
|
QList< double > | columnStretchFactors () const |
|
QList< double > | rowStretchFactors () const |
|
int | columnSpacing () const |
|
int | rowSpacing () const |
|
int | wrap () const |
|
FillOrder | fillOrder () const |
|
void | setColumnStretchFactor (int column, double factor) |
|
void | setColumnStretchFactors (const QList< double > &factors) |
|
void | setRowStretchFactor (int row, double factor) |
|
void | setRowStretchFactors (const QList< double > &factors) |
|
void | setColumnSpacing (int pixels) |
|
void | setRowSpacing (int pixels) |
|
void | setWrap (int count) |
|
void | setFillOrder (FillOrder order, bool rearrange=true) |
|
virtual void | updateLayout () Q_DECL_OVERRIDE |
|
virtual int | elementCount () const Q_DECL_OVERRIDE |
|
virtual QCPLayoutElement * | elementAt (int index) const Q_DECL_OVERRIDE |
|
virtual QCPLayoutElement * | takeAt (int index) Q_DECL_OVERRIDE |
|
virtual bool | take (QCPLayoutElement *element) Q_DECL_OVERRIDE |
|
virtual QList< QCPLayoutElement * > | elements (bool recursive) const Q_DECL_OVERRIDE |
|
virtual void | simplify () Q_DECL_OVERRIDE |
|
virtual QSize | minimumOuterSizeHint () const Q_DECL_OVERRIDE |
|
virtual QSize | maximumOuterSizeHint () const Q_DECL_OVERRIDE |
|
QCPLayoutElement * | element (int row, int column) const |
|
bool | addElement (int row, int column, QCPLayoutElement *element) |
|
bool | addElement (QCPLayoutElement *element) |
|
bool | hasElement (int row, int column) |
|
void | expandTo (int newRowCount, int newColumnCount) |
|
void | insertRow (int newIndex) |
|
void | insertColumn (int newIndex) |
|
int | rowColToIndex (int row, int column) const |
|
void | indexToRowCol (int index, int &row, int &column) const |
|
| QCPLayout () |
|
virtual void | update (UpdatePhase phase) Q_DECL_OVERRIDE |
|
bool | removeAt (int index) |
|
bool | remove (QCPLayoutElement *element) |
|
void | clear () |
|
| 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) |
|
| 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 |
|
|
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) Q_DECL_OVERRIDE |
|
virtual QCP::Interaction | selectionCategory () const Q_DECL_OVERRIDE |
|
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
|
virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
|
virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE |
|
virtual void | deselectEvent (bool *selectionStateChanged) Q_DECL_OVERRIDE |
|
QPen | getBorderPen () const |
|
QBrush | getBrush () const |
|
void | getMinimumRowColSizes (QVector< int > *minColWidths, QVector< int > *minRowHeights) const |
|
void | getMaximumRowColSizes (QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const |
|
void | sizeConstraintsChanged () const |
|
void | adoptElement (QCPLayoutElement *el) |
|
void | releaseElement (QCPLayoutElement *el) |
|
QVector< int > | getSectionSizes (QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const |
|
virtual int | calculateAutoMargin (QCP::MarginSide side) |
|
virtual void | layoutChanged () |
|
virtual QRect | clipRect () const |
|
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) |
|
virtual void | wheelEvent (QWheelEvent *event) |
|
void | initializeParentPlot (QCustomPlot *parentPlot) |
|
void | setParentLayerable (QCPLayerable *parentLayerable) |
|
bool | moveToLayer (QCPLayer *layer, bool prepend) |
|
void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
|
Manages a legend inside a QCustomPlot.
A legend is a small box somewhere in the plot which lists plottables with their name and icon.
A legend is populated with legend items by calling QCPAbstractPlottable::addToLegend on the plottable, for which a legend item shall be created. In the case of the main legend (QCustomPlot::legend), simply adding plottables to the plot while QCustomPlot::setAutoAddPlottableToLegend is set to true (the default) creates corresponding legend items. The legend item associated with a certain plottable can be removed with QCPAbstractPlottable::removeFromLegend. However, QCPLegend also offers an interface to add and manipulate legend items directly: item, itemWithPlottable, itemCount, addItem, removeItem, etc.
Since QCPLegend derives from QCPLayoutGrid, it can be placed in any position a QCPLayoutElement may be positioned. The legend items are themselves QCPLayoutElements which are placed in the grid layout of the legend. QCPLegend only adds an interface specialized for handling child elements of type QCPAbstractLegendItem, as mentioned above. In principle, any other layout elements may also be added to a legend via the normal QCPLayoutGrid interface. See the special page about The Layout System for examples on how to add other elements to the legend and move it outside the axis rect.
Use the methods setFillOrder and setWrap inherited from QCPLayoutGrid to control in which order (column first or row first) the legend is filled up when calling addItem, and at which column or row wrapping occurs.
By default, every QCustomPlot has one legend (QCustomPlot::legend) which is placed in the inset layout of the main axis rect (QCPAxisRect::insetLayout). To move the legend to another position inside the axis rect, use the methods of the QCPLayoutInset. To move the legend outside of the axis rect, place it anywhere else with the QCPLayout/ QCPLayoutElement interface.
bool QCPLegend::removeItem |
( |
int |
index | ) |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Removes the item with the specified index from the legend and deletes it.
After successful removal, the legend is reordered according to the current fill order (setFillOrder) and wrapping (setWrap), so no empty cell remains where the removed item was. If you don't want this, rather use the raw element interface of QCPLayoutGrid.
Returns true, if successful. Unlike QCPLayoutGrid::removeAt, this method only removes elements derived from QCPAbstractLegendItem.
- See also
- itemCount, clearItems
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Removes item from the legend and deletes it.
After successful removal, the legend is reordered according to the current fill order (setFillOrder) and wrapping (setWrap), so no empty cell remains where the removed item was. If you don't want this, rather use the raw element interface of QCPLayoutGrid.
Returns true, if successful.
- See also
- clearItems
double QCPLegend::selectTest |
( |
const QPointF & |
pos, |
|
|
bool |
onlySelectable, |
|
|
QVariant * |
details = 0 |
|
) |
| const |
|
virtual |
Layout elements are sensitive to events inside their outer rect. If pos is within the outer rect, this method returns a value corresponding to 0.99 times the parent plot's selection tolerance. However, layout elements are not selectable by default. So if onlySelectable is true, -1.0 is returned.
See QCPLayerable::selectTest for a general explanation of this virtual method.
QCPLayoutElement subclasses may reimplement this method to provide more specific selection test behaviour.
Reimplemented from QCPLayoutElement.
void QCPLegend::setSelectedParts |
( |
const SelectableParts & |
selected | ) |
|