QCPSelectionDecorator
Public Member Functions | |
QCPSelectionDecorator () | |
void | applyBrush (QCPPainter *painter) const |
void | applyPen (QCPPainter *painter) const |
QBrush | brush () const |
virtual void | copyFrom (const QCPSelectionDecorator *other) |
virtual void | drawDecoration (QCPPainter *painter, QCPDataSelection selection) |
QCPScatterStyle | getFinalScatterStyle (const QCPScatterStyle &unselectedStyle) const |
QPen | pen () const |
QCPScatterStyle | scatterStyle () const |
void | setBrush (const QBrush &brush) |
void | setPen (const QPen &pen) |
void | setScatterStyle (const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties=QCPScatterStyle::spPen) |
void | setUsedScatterProperties (const QCPScatterStyle::ScatterProperties &properties) |
QCPScatterStyle::ScatterProperties | usedScatterProperties () const |
Protected Member Functions | |
virtual bool | registerWithPlottable (QCPAbstractPlottable *plottable) |
Protected Attributes | |
QBrush | mBrush |
QPen | mPen |
QCPAbstractPlottable * | mPlottable |
QCPScatterStyle | mScatterStyle |
QCPScatterStyle::ScatterProperties | mUsedScatterProperties |
Detailed Description
Controls how a plottable's data selection is drawn.
Each QCPAbstractPlottable instance has one QCPSelectionDecorator (accessible via QCPAbstractPlottable::selectionDecorator) and uses it when drawing selected segments of its data.
The selection decorator controls both pen (setPen) and brush (setBrush), as well as the scatter style (setScatterStyle) if the plottable draws scatters. Since a QCPScatterStyle is itself composed of different properties such as color shape and size, the decorator allows specifying exactly which of those properties shall be used for the selected data point, via setUsedScatterProperties.
A QCPSelectionDecorator subclass instance can be passed to a plottable via QCPAbstractPlottable::setSelectionDecorator, allowing greater customizability of the appearance of selected segments.
Use copyFrom to easily transfer the settings of one decorator to another one. This is especially useful since plottables take ownership of the passed selection decorator, and thus the same decorator instance can not be passed to multiple plottables.
Selection decorators can also themselves perform drawing operations by reimplementing drawDecoration, which is called by the plottable's draw method. The base class QCPSelectionDecorator does not make use of this however. For example, QCPSelectionDecoratorBracket draws brackets around selected data segments.
Definition at line 3448 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPSelectionDecorator()
QCPSelectionDecorator::QCPSelectionDecorator | ( | ) |
Creates a new QCPSelectionDecorator instance with default values
Definition at line 11062 of file qcustomplot.cpp.
◆ ~QCPSelectionDecorator()
|
virtual |
Definition at line 11070 of file qcustomplot.cpp.
Member Function Documentation
◆ applyBrush()
void QCPSelectionDecorator::applyBrush | ( | QCPPainter * | painter | ) | const |
Sets the brush of painter to the brush of this selection decorator.
- See also
- applyPen, getFinalScatterStyle
Definition at line 11130 of file qcustomplot.cpp.
◆ applyPen()
void QCPSelectionDecorator::applyPen | ( | QCPPainter * | painter | ) | const |
Sets the pen of painter to the pen of this selection decorator.
- See also
- applyBrush, getFinalScatterStyle
Definition at line 11120 of file qcustomplot.cpp.
◆ brush()
|
inline |
Definition at line 3457 of file qcustomplot.h.
◆ copyFrom()
|
virtual |
Copies all properties (e.g. color, fill, scatter style) of the other selection decorator to this selection decorator.
Definition at line 11161 of file qcustomplot.cpp.
◆ drawDecoration()
|
virtual |
This method is called by all plottables' draw methods to allow custom selection decorations to be drawn. Use the passed painter to perform the drawing operations. selection carries the data selection for which the decoration shall be drawn.
The default base class implementation of QCPSelectionDecorator has no special decoration, so this method does nothing.
Reimplemented in QCPSelectionDecoratorBracket.
Definition at line 11176 of file qcustomplot.cpp.
◆ getFinalScatterStyle()
QCPScatterStyle QCPSelectionDecorator::getFinalScatterStyle | ( | const QCPScatterStyle & | unselectedStyle | ) | const |
Returns the scatter style that the parent plottable shall use for selected scatter points. The plottable's original (unselected) scatter style must be passed as unselectedStyle. Depending on the setting of setUsedScatterProperties, the returned scatter style is a mixture of this selecion decorator's scatter style (setScatterStyle), and unselectedStyle.
- See also
- applyPen, applyBrush, setScatterStyle
Definition at line 11143 of file qcustomplot.cpp.
◆ pen()
|
inline |
Definition at line 3456 of file qcustomplot.h.
◆ registerWithPlottable()
|
protectedvirtual |
This method is called as soon as a selection decorator is associated with a plottable, by a call to QCPAbstractPlottable::setSelectionDecorator. This way the selection decorator can obtain a pointer to the plottable that uses it (e.g. to access data points via the QCPAbstractPlottable::interface1D interface).
If the selection decorator was already added to a different plottable before, this method aborts the registration and returns false.
Definition at line 11191 of file qcustomplot.cpp.
◆ scatterStyle()
|
inline |
Definition at line 3458 of file qcustomplot.h.
◆ setBrush()
void QCPSelectionDecorator::setBrush | ( | const QBrush & | brush | ) |
Sets the brush that will be used by the parent plottable to draw selected data segments.
Definition at line 11085 of file qcustomplot.cpp.
◆ setPen()
void QCPSelectionDecorator::setPen | ( | const QPen & | pen | ) |
Sets the pen that will be used by the parent plottable to draw selected data segments.
Definition at line 11077 of file qcustomplot.cpp.
◆ setScatterStyle()
void QCPSelectionDecorator::setScatterStyle | ( | const QCPScatterStyle & | scatterStyle, |
QCPScatterStyle::ScatterProperties | usedProperties = QCPScatterStyle::spPen ) |
Sets the scatter style that will be used by the parent plottable to draw scatters in selected data segments.
usedProperties specifies which parts of the passed scatterStyle will be used by the plottable. The used properties can also be changed via setUsedScatterProperties.
Definition at line 11097 of file qcustomplot.cpp.
◆ setUsedScatterProperties()
void QCPSelectionDecorator::setUsedScatterProperties | ( | const QCPScatterStyle::ScatterProperties & | properties | ) |
Use this method to define which properties of the scatter style (set via setScatterStyle) will be used for selected data segments. All properties of the scatter style that are not specified in properties will remain as specified in the plottable's original scatter style.
- See also
- QCPScatterStyle::ScatterProperty
Definition at line 11110 of file qcustomplot.cpp.
◆ usedScatterProperties()
|
inline |
Definition at line 3459 of file qcustomplot.h.
Member Data Documentation
◆ mBrush
|
protected |
Definition at line 3479 of file qcustomplot.h.
◆ mPen
|
protected |
Definition at line 3478 of file qcustomplot.h.
◆ mPlottable
|
protected |
Definition at line 3483 of file qcustomplot.h.
◆ mScatterStyle
|
protected |
Definition at line 3480 of file qcustomplot.h.
◆ mUsedScatterProperties
|
protected |
Definition at line 3481 of file qcustomplot.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.