|
OmronPID
|
Manages a legend inside a QCustomPlot. More...
Public Types | |
| enum | SelectablePart { spNone = 0x000 , spLegendBox = 0x001 , spItems = 0x002 } |
| Defines the selectable parts of a legend. More... | |
Public Types inherited from QCPLayoutGrid | |
| enum | FillOrder { foRowsFirst , foColumnsFirst } |
| Defines in which direction the grid is filled when using addElement(QCPLayoutElement*). More... | |
Public Types inherited from QCPLayoutElement | |
| enum | UpdatePhase { upPreparation , upMargins , upLayout } |
| Defines the phases of the update process, that happens just before a replot. More... | |
| enum | SizeConstraintRect { scrInnerRect , scrOuterRect } |
| Defines to which rect of a layout element the size constraints that can be set via setMinimumSize and setMaximumSize apply. More... | |
Signals | |
| void | selectionChanged (QCPLegend::SelectableParts parts) |
| This signal is emitted when the selection state of this legend has changed. | |
| void | selectableChanged (QCPLegend::SelectableParts parts) |
Signals inherited from QCPLayerable | |
| void | layerChanged (QCPLayer *newLayer) |
| This signal is emitted when the layer of this layerable changes, i.e. | |
Public Member Functions | |
| QCPLegend () | |
| Constructs a new QCPLegend instance with default values. | |
| 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) |
| Sets the pen, the border of the entire legend is drawn with. | |
| void | setBrush (const QBrush &brush) |
| Sets the brush of the legend background. | |
| void | setFont (const QFont &font) |
| Sets the default font of legend text. | |
| void | setTextColor (const QColor &color) |
| Sets the default color of legend text. | |
| void | setIconSize (const QSize &size) |
| Sets the size of legend icons. | |
| void | setIconSize (int width, int height) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| void | setIconTextPadding (int padding) |
| Sets the horizontal space in pixels between the legend icon and the text next to it. | |
| void | setIconBorderPen (const QPen &pen) |
| Sets the pen used to draw a border around each legend icon. | |
| Q_SLOT void | setSelectableParts (const SelectableParts &selectableParts) |
| Sets whether the user can (de-)select the parts in selectable by clicking on the QCustomPlot surface. | |
| Q_SLOT void | setSelectedParts (const SelectableParts &selectedParts) |
| Sets the selected state of the respective legend parts described by SelectablePart. | |
| void | setSelectedBorderPen (const QPen &pen) |
| When the legend box is selected, this pen is used to draw the border instead of the normal pen set via setBorderPen. | |
| void | setSelectedIconBorderPen (const QPen &pen) |
| Sets the pen legend items will use to draw their icon borders, when they are selected. | |
| void | setSelectedBrush (const QBrush &brush) |
| When the legend box is selected, this brush is used to draw the legend background instead of the normal brush set via setBrush. | |
| void | setSelectedFont (const QFont &font) |
| Sets the default font that is used by legend items when they are selected. | |
| void | setSelectedTextColor (const QColor &color) |
| Sets the default text color that is used by legend items when they are selected. | |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE |
| Layout elements are sensitive to events inside their outer rect. | |
| QCPAbstractLegendItem * | item (int index) const |
| Returns the item with index i. | |
| QCPPlottableLegendItem * | itemWithPlottable (const QCPAbstractPlottable *plottable) const |
| Returns the QCPPlottableLegendItem which is associated with plottable (e.g. | |
| int | itemCount () const |
| Returns the number of items currently in the legend. | |
| bool | hasItem (QCPAbstractLegendItem *item) const |
| Returns whether the legend contains item. | |
| bool | hasItemWithPlottable (const QCPAbstractPlottable *plottable) const |
| Returns whether the legend contains a QCPPlottableLegendItem which is associated with plottable (e.g. | |
| bool | addItem (QCPAbstractLegendItem *item) |
| Adds item to the legend, if it's not present already. | |
| bool | 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. | |
| bool | removeItem (QCPAbstractLegendItem *item) |
| 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. | |
| void | clearItems () |
| Removes all items from the legend. | |
| QList< QCPAbstractLegendItem * > | selectedItems () const |
| Returns the legend items that are currently selected. | |
Public Member Functions inherited from QCPLayoutGrid | |
| QCPLayoutGrid () | |
| Creates an instance of QCPLayoutGrid and sets default values. | |
| int | rowCount () const |
| Returns the number of rows in the layout. | |
| int | columnCount () const |
| Returns the number of columns in the layout. | |
| 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) |
| Sets the stretch factor of column. | |
| void | setColumnStretchFactors (const QList< double > &factors) |
| Sets the stretch factors of all columns. | |
| void | setRowStretchFactor (int row, double factor) |
| Sets the stretch factor of row. | |
| void | setRowStretchFactors (const QList< double > &factors) |
| Sets the stretch factors of all rows. | |
| void | setColumnSpacing (int pixels) |
| Sets the gap that is left blank between columns to pixels. | |
| void | setRowSpacing (int pixels) |
| Sets the gap that is left blank between rows to pixels. | |
| void | setWrap (int count) |
| Sets the maximum number of columns or rows that are used, before new elements added with addElement(QCPLayoutElement*) will start to fill the next row or column, respectively. | |
| void | setFillOrder (FillOrder order, bool rearrange=true) |
| Sets the filling order and wrapping behaviour that is used when adding new elements with the method addElement(QCPLayoutElement*). | |
| virtual void | updateLayout () Q_DECL_OVERRIDE |
| virtual int | elementCount () const Q_DECL_OVERRIDE |
| Returns the number of elements/cells in the layout. | |
| virtual QCPLayoutElement * | elementAt (int index) const Q_DECL_OVERRIDE |
| \seebaseclassmethod | |
| virtual QCPLayoutElement * | takeAt (int index) Q_DECL_OVERRIDE |
| \seebaseclassmethod | |
| virtual bool | take (QCPLayoutElement *element) Q_DECL_OVERRIDE |
| Removes the specified element from the layout and returns true on success. | |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const Q_DECL_OVERRIDE |
| Returns a list of all child elements in this layout element. | |
| virtual void | simplify () Q_DECL_OVERRIDE |
| Simplifies the layout by collapsing rows and columns which only contain empty cells. | |
| virtual QSize | minimumOuterSizeHint () const Q_DECL_OVERRIDE |
| Returns the suggested minimum size this layout element (the outerRect) may be compressed to, if no manual minimum size is set. | |
| virtual QSize | maximumOuterSizeHint () const Q_DECL_OVERRIDE |
| Returns the suggested maximum size this layout element (the outerRect) may be expanded to, if no manual maximum size is set. | |
| QCPLayoutElement * | element (int row, int column) const |
| Returns the element in the cell in row and column. | |
| bool | addElement (int row, int column, QCPLayoutElement *element) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds the element to cell with row and column. | |
| bool | addElement (QCPLayoutElement *element) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Adds the element to the next empty cell according to the current fill order (setFillOrder) and wrapping (setWrap). | |
| bool | hasElement (int row, int column) |
| Returns whether the cell at row and column exists and contains a valid element, i.e. | |
| void | expandTo (int newRowCount, int newColumnCount) |
| Expands the layout to have newRowCount rows and newColumnCount columns. | |
| void | insertRow (int newIndex) |
| Inserts a new row with empty cells at the row index newIndex. | |
| void | insertColumn (int newIndex) |
| Inserts a new column with empty cells at the column index newIndex. | |
| int | rowColToIndex (int row, int column) const |
| Converts the given row and column to the linear index used by some methods of QCPLayoutGrid and QCPLayout. | |
| void | indexToRowCol (int index, int &row, int &column) const |
| Converts the linear index to row and column indices and writes the result to row and column. | |
Public Member Functions inherited from QCPLayout | |
| QCPLayout () | |
| Creates an instance of QCPLayout and sets default values. | |
| virtual void | update (UpdatePhase phase) Q_DECL_OVERRIDE |
| If phase is upLayout, calls updateLayout, which subclasses may reimplement to reposition and resize their cells. | |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const Q_DECL_OVERRIDE |
| Returns a list of all child elements in this layout element. | |
| virtual int | elementCount () const =0 |
| Returns the number of elements/cells in the layout. | |
| virtual QCPLayoutElement * | elementAt (int index) const =0 |
| Returns the element in the cell with the given index. | |
| virtual QCPLayoutElement * | takeAt (int index)=0 |
| Removes the element with the given index from the layout and returns it. | |
| virtual bool | take (QCPLayoutElement *element)=0 |
| Removes the specified element from the layout and returns true on success. | |
| virtual void | simplify () |
| Simplifies the layout by collapsing empty cells. | |
| bool | removeAt (int index) |
| Removes and deletes the element at the provided index. | |
| bool | remove (QCPLayoutElement *element) |
| Removes and deletes the provided element. | |
| void | clear () |
| Removes and deletes all layout elements in this layout. | |
Public Member Functions inherited from QCPLayoutElement | |
| QCPLayoutElement (QCustomPlot *parentPlot=0) | |
| Creates an instance of QCPLayoutElement and sets default values. | |
| QCPLayout * | layout () const |
| Returns the parent layout of this layout element. | |
| QRect | rect () const |
| Returns the inner rect of this layout element. | |
| QRect | outerRect () const |
| Returns the outer rect of this layout element. | |
| 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) |
| Sets the outer rect of this layout element. | |
| void | setMargins (const QMargins &margins) |
| Sets the margins of this layout element. | |
| void | setMinimumMargins (const QMargins &margins) |
| If setAutoMargins is enabled on some or all margins, this function is used to provide minimum values for those margins. | |
| void | setAutoMargins (QCP::MarginSides sides) |
| Sets on which sides the margin shall be calculated automatically. | |
| void | setMinimumSize (const QSize &size) |
| Sets the minimum size of this layout element. | |
| void | setMinimumSize (int width, int height) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the minimum size of this layout element. | |
| void | setMaximumSize (const QSize &size) |
| Sets the maximum size of this layout element. | |
| void | setMaximumSize (int width, int height) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the maximum size of this layout element. | |
| void | setSizeConstraintRect (SizeConstraintRect constraintRect) |
| Sets to which rect of a layout element the size constraints apply. | |
| void | setMarginGroup (QCP::MarginSides sides, QCPMarginGroup *group) |
| Sets the margin group of the specified margin sides. | |
| virtual void | update (UpdatePhase phase) |
| Updates the layout element and sub-elements. | |
| virtual QSize | minimumOuterSizeHint () const |
| Returns the suggested minimum size this layout element (the outerRect) may be compressed to, if no manual minimum size is set. | |
| virtual QSize | maximumOuterSizeHint () const |
| Returns the suggested maximum size this layout element (the outerRect) may be expanded to, if no manual maximum size is set. | |
| virtual QList< QCPLayoutElement * > | elements (bool recursive) const |
| Returns a list of all child elements in this layout element. | |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE |
| Layout elements are sensitive to events inside their outer rect. | |
Public Member Functions inherited from QCPLayerable | |
| QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
| Creates a new QCPLayerable instance. | |
| bool | visible () const |
| QCustomPlot * | parentPlot () const |
| QCPLayerable * | parentLayerable () const |
| Returns the parent layerable of this layerable. | |
| QCPLayer * | layer () const |
| bool | antialiased () const |
| void | setVisible (bool on) |
| Sets the visibility of this layerable object. | |
| Q_SLOT bool | setLayer (QCPLayer *layer) |
| Sets the layer of this layerable object. | |
| bool | setLayer (const QString &layerName) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the layer of this layerable object by name. | |
| void | setAntialiased (bool enabled) |
| Sets whether this object will be drawn antialiased or not. | |
| virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const |
| This function is used to decide whether a click hits a layerable object or not. | |
| bool | realVisibility () const |
| Returns whether this layerable is visible, taking the visibility of the layerable parent and the visibility of this layerable's layer into account. | |
Protected Member Functions | |
| 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 |
Protected Member Functions inherited from QCPLayoutGrid | |
| void | getMinimumRowColSizes (QVector< int > *minColWidths, QVector< int > *minRowHeights) const |
| void | getMaximumRowColSizes (QVector< int > *maxColWidths, QVector< int > *maxRowHeights) const |
Protected Member Functions inherited from QCPLayout | |
| virtual void | updateLayout () |
| void | sizeConstraintsChanged () const |
| Subclasses call this method to report changed (minimum/maximum) size constraints. | |
| void | adoptElement (QCPLayoutElement *el) |
| void | releaseElement (QCPLayoutElement *el) |
| QVector< int > | getSectionSizes (QVector< int > maxSizes, QVector< int > minSizes, QVector< double > stretchFactors, int totalSize) const |
Protected Member Functions inherited from QCPLayoutElement | |
| virtual int | calculateAutoMargin (QCP::MarginSide side) |
| virtual void | layoutChanged () |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
| virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) Q_DECL_OVERRIDE |
Protected Member Functions inherited from QCPLayerable | |
| virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
| virtual QCP::Interaction | selectionCategory () const |
| virtual QRect | clipRect () const |
| virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const =0 |
| virtual void | draw (QCPPainter *painter)=0 |
| virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) |
| virtual void | deselectEvent (bool *selectionStateChanged) |
| virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) |
| This event gets called when the user presses a mouse button while the cursor is over the layerable. | |
| virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) |
| This event gets called when the user moves the mouse while holding a mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent. | |
| virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) |
| This event gets called when the user releases the mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent. | |
| virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
| This event gets called when the user presses the mouse button a second time in a double-click, while the cursor is over the layerable. | |
| virtual void | wheelEvent (QWheelEvent *event) |
| This event gets called when the user turns the mouse scroll wheel while the cursor is over the layerable. | |
| 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 | |
| QPen | mBorderPen |
| QPen | mIconBorderPen |
| QBrush | mBrush |
| QFont | mFont |
| QColor | mTextColor |
| QSize | mIconSize |
| int | mIconTextPadding |
| SelectableParts | mSelectedParts |
| SelectableParts | mSelectableParts |
| QPen | mSelectedBorderPen |
| QPen | mSelectedIconBorderPen |
| QBrush | mSelectedBrush |
| QFont | mSelectedFont |
| QColor | mSelectedTextColor |
Protected Attributes inherited from QCPLayoutGrid | |
| QList< QList< QCPLayoutElement * > > | mElements |
| QList< double > | mColumnStretchFactors |
| QList< double > | mRowStretchFactors |
| int | mColumnSpacing |
| int | mRowSpacing |
| int | mWrap |
| FillOrder | mFillOrder |
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 |
Friends | |
| class | QCustomPlot |
| class | QCPAbstractLegendItem |
Additional Inherited Members | |
Static Protected Member Functions inherited from QCPLayout | |
| static QSize | getFinalMinimumOuterSize (const QCPLayoutElement *el) |
| static QSize | getFinalMaximumOuterSize (const QCPLayoutElement *el) |
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.
Defines the selectable parts of a legend.
| Enumerator | |
|---|---|
| spNone |
|
| spLegendBox |
|
| spItems |
|
|
explicit |
Constructs a new QCPLegend instance with default values.
Note that by default, QCustomPlot already contains a legend ready to be used as QCustomPlot::legend
| bool QCPLegend::addItem | ( | QCPAbstractLegendItem * | item | ) |
Adds item to the legend, if it's not present already.
The element is arranged according to the current fill order (setFillOrder) and wrapping (setWrap).
Returns true on sucess, i.e. if the item wasn't in the list already and has been successfuly added.
The legend takes ownership of the item.
|
protectedvirtual |
Reimplemented from QCPLayoutElement.
|
protectedvirtual |
Reimplemented from QCPLayerable.
|
protectedvirtual |
Reimplemented from QCPLayoutElement.
| bool QCPLegend::hasItem | ( | QCPAbstractLegendItem * | item | ) | const |
Returns whether the legend contains item.
| bool QCPLegend::hasItemWithPlottable | ( | const QCPAbstractPlottable * | plottable | ) | const |
Returns whether the legend contains a QCPPlottableLegendItem which is associated with plottable (e.g.
a QCPGraph*). If such an item isn't in the legend, returns false.
| QCPAbstractLegendItem * QCPLegend::item | ( | int | index | ) | const |
Returns the item with index i.
Note that the linear index depends on the current fill order (setFillOrder).
| int QCPLegend::itemCount | ( | ) | const |
Returns the number of items currently in the legend.
Note that if empty cells are in the legend (e.g. by calling methods of the QCPLayoutGrid base class which allows creating empty cells), they are included in the returned count.
| QCPPlottableLegendItem * QCPLegend::itemWithPlottable | ( | const QCPAbstractPlottable * | plottable | ) | const |
Returns the QCPPlottableLegendItem which is associated with plottable (e.g.
a QCPGraph*). If such an item isn't in the legend, returns 0.
|
protectedvirtual |
Reimplemented from QCPLayoutElement.
| 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.
| bool QCPLegend::removeItem | ( | QCPAbstractLegendItem * | item | ) |
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.
| QList< QCPAbstractLegendItem * > QCPLegend::selectedItems | ( | ) | const |
Returns the legend items that are currently selected.
If no items are selected, the list is empty.
|
protectedvirtual |
Reimplemented from QCPLayerable.
|
protectedvirtual |
Reimplemented from QCPLayerable.
|
signal |
This signal is emitted when the selection state of this legend has changed.
|
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::setFont | ( | const QFont & | font | ) |
Sets the default font of legend text.
Legend items that draw text (e.g. the name of a graph) will use this font by default. However, a different font can be specified on a per-item-basis by accessing the specific legend item.
This function will also set font on all already existing legend items.
| void QCPLegend::setIconBorderPen | ( | const QPen & | pen | ) |
Sets the pen used to draw a border around each legend icon.
Legend items that draw an icon (e.g. a visual representation of the graph) will use this pen by default.
If no border is wanted, set this to Qt::NoPen.
| void QCPLegend::setIconSize | ( | const QSize & | size | ) |
Sets the size of legend icons.
Legend items that draw an icon (e.g. a visual representation of the graph) will use this size by default.
| void QCPLegend::setIconTextPadding | ( | int | padding | ) |
Sets the horizontal space in pixels between the legend icon and the text next to it.
Legend items that draw an icon (e.g. a visual representation of the graph) and text (e.g. the name of the graph) will use this space by default.
| void QCPLegend::setSelectableParts | ( | const SelectableParts & | selectable | ) |
Sets whether the user can (de-)select the parts in selectable by clicking on the QCustomPlot surface.
(When QCustomPlot::setInteractions contains QCP::iSelectLegend.)
However, even when selectable is set to a value not allowing the selection of a specific part, it is still possible to set the selection of this part manually, by calling setSelectedParts directly.
| void QCPLegend::setSelectedBorderPen | ( | const QPen & | pen | ) |
When the legend box is selected, this pen is used to draw the border instead of the normal pen set via setBorderPen.
| void QCPLegend::setSelectedBrush | ( | const QBrush & | brush | ) |
When the legend box is selected, this brush is used to draw the legend background instead of the normal brush set via setBrush.
| void QCPLegend::setSelectedFont | ( | const QFont & | font | ) |
Sets the default font that is used by legend items when they are selected.
This function will also set font on all already existing legend items.
| void QCPLegend::setSelectedIconBorderPen | ( | const QPen & | pen | ) |
Sets the pen legend items will use to draw their icon borders, when they are selected.
| void QCPLegend::setSelectedParts | ( | const SelectableParts & | selected | ) |
Sets the selected state of the respective legend parts described by SelectablePart.
When a part is selected, it uses a different pen/font and brush. If some legend items are selected and selected doesn't contain spItems, those items become deselected.
The entire selection mechanism is handled automatically when QCustomPlot::setInteractions contains iSelectLegend. You only need to call this function when you wish to change the selection state manually.
This function can change the selection state of a part even when setSelectableParts was set to a value that actually excludes the part.
emits the selectionChanged signal when selected is different from the previous selection state.
Note that it doesn't make sense to set the selected state spItems here when it wasn't set before, because there's no way to specify which exact items to newly select. Do this by calling QCPAbstractLegendItem::setSelected directly on the legend item you wish to select.
| void QCPLegend::setSelectedTextColor | ( | const QColor & | color | ) |
Sets the default text color that is used by legend items when they are selected.
This function will also set color on all already existing legend items.
| void QCPLegend::setTextColor | ( | const QColor & | color | ) |
Sets the default color of legend text.
Legend items that draw text (e.g. the name of a graph) will use this color by default. However, a different colors can be specified on a per-item-basis by accessing the specific legend item.
This function will also set color on all already existing legend items.