QCPSelectionDecoratorBracket

Search for usage in LXR

Inheritance diagram for QCPSelectionDecoratorBracket:

Public Types

enum  BracketStyle {
  bsSquareBracket , bsHalfEllipse , bsEllipse , bsPlus ,
  bsUserStyle
}
 

Public Member Functions

 QCPSelectionDecoratorBracket ()
 
QBrush bracketBrush () const
 
int bracketHeight () const
 
QPen bracketPen () const
 
BracketStyle bracketStyle () const
 
int bracketWidth () const
 
virtual void drawBracket (QCPPainter *painter, int direction) const
 
virtual void drawDecoration (QCPPainter *painter, QCPDataSelection selection) override
 
void setBracketBrush (const QBrush &brush)
 
void setBracketHeight (int height)
 
void setBracketPen (const QPen &pen)
 
void setBracketStyle (BracketStyle style)
 
void setBracketWidth (int width)
 
void setTangentAverage (int pointCount)
 
void setTangentToData (bool enabled)
 
int tangentAverage () const
 
bool tangentToData () const
 
- Public Member Functions inherited from QCPSelectionDecorator
 QCPSelectionDecorator ()
 
void applyBrush (QCPPainter *painter) const
 
void applyPen (QCPPainter *painter) const
 
QBrush brush () const
 
virtual void copyFrom (const QCPSelectionDecorator *other)
 
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

QPointF getPixelCoordinates (const QCPPlottableInterface1D *interface1d, int dataIndex) const
 
double getTangentAngle (const QCPPlottableInterface1D *interface1d, int dataIndex, int direction) const
 
- Protected Member Functions inherited from QCPSelectionDecorator
virtual bool registerWithPlottable (QCPAbstractPlottable *plottable)
 

Protected Attributes

QBrush mBracketBrush
 
int mBracketHeight
 
QPen mBracketPen
 
BracketStyle mBracketStyle
 
int mBracketWidth
 
int mTangentAverage
 
bool mTangentToData
 
- Protected Attributes inherited from QCPSelectionDecorator
QBrush mBrush
 
QPen mPen
 
QCPAbstractPlottablemPlottable
 
QCPScatterStyle mScatterStyle
 
QCPScatterStyle::ScatterProperties mUsedScatterProperties
 

Detailed Description

A selection decorator which draws brackets around each selected data segment.

Additionally to the regular highlighting of selected segments via color, fill and scatter style, this QCPSelectionDecorator subclass draws markers at the begin and end of each selected data segment of the plottable.

The shape of the markers can be controlled with setBracketStyle, setBracketWidth and setBracketHeight. The color/fill can be controlled with setBracketPen and setBracketBrush.

To introduce custom bracket styles, it is only necessary to sublcass QCPSelectionDecoratorBracket and reimplement drawBracket. The rest will be managed by the base class.

Definition at line 4797 of file qcustomplot.h.

Member Enumeration Documentation

◆ BracketStyle

Defines which shape is drawn at the boundaries of selected data ranges.

Some of the bracket styles further allow specifying a height and/or width, see setBracketHeight and setBracketWidth.

Enumerator
bsSquareBracket 

A square bracket is drawn.

bsHalfEllipse 

A half ellipse is drawn. The size of the ellipse is given by the bracket width/height properties.

bsEllipse 

An ellipse is drawn. The size of the ellipse is given by the bracket width/height properties.

bsPlus 

A plus is drawn.

bsUserStyle 

Start custom bracket styles at this index when subclassing and reimplementing drawBracket.

Definition at line 4808 of file qcustomplot.h.

Constructor & Destructor Documentation

◆ QCPSelectionDecoratorBracket()

QCPSelectionDecoratorBracket::QCPSelectionDecoratorBracket ( )

Creates a new QCPSelectionDecoratorBracket instance with default values.

Definition at line 17158 of file qcustomplot.cpp.

◆ ~QCPSelectionDecoratorBracket()

QCPSelectionDecoratorBracket::~QCPSelectionDecoratorBracket ( )
overridevirtual

Definition at line 17170 of file qcustomplot.cpp.

Member Function Documentation

◆ bracketBrush()

QBrush QCPSelectionDecoratorBracket::bracketBrush ( ) const
inline

Definition at line 4821 of file qcustomplot.h.

◆ bracketHeight()

int QCPSelectionDecoratorBracket::bracketHeight ( ) const
inline

Definition at line 4823 of file qcustomplot.h.

◆ bracketPen()

QPen QCPSelectionDecoratorBracket::bracketPen ( ) const
inline

Definition at line 4820 of file qcustomplot.h.

◆ bracketStyle()

BracketStyle QCPSelectionDecoratorBracket::bracketStyle ( ) const
inline

Definition at line 4824 of file qcustomplot.h.

◆ bracketWidth()

int QCPSelectionDecoratorBracket::bracketWidth ( ) const
inline

Definition at line 4822 of file qcustomplot.h.

◆ drawBracket()

void QCPSelectionDecoratorBracket::drawBracket ( QCPPainter * painter,
int direction ) const
virtual

Draws the bracket shape with painter. The parameter direction is either -1 or 1 and indicates whether the bracket shall point to the left or the right (i.e. is a closing or opening bracket, respectively).

The passed painter already contains all transformations that are necessary to position and rotate the bracket appropriately. Painting operations can be performed as if drawing upright brackets on flat data with horizontal key axis, with (0, 0) being the center of the bracket.

If you wish to sublcass QCPSelectionDecoratorBracket in order to provide custom bracket shapes (see QCPSelectionDecoratorBracket::bsUserStyle), this is the method you should reimplement.

Definition at line 17262 of file qcustomplot.cpp.

◆ drawDecoration()

void QCPSelectionDecoratorBracket::drawDecoration ( QCPPainter * painter,
QCPDataSelection selection )
overridevirtual

Draws the bracket decoration on the data points at the begin and end of each selected data segment given in seletion.

It uses the method drawBracket to actually draw the shapes.

\seebaseclassmethod

Reimplemented from QCPSelectionDecorator.

Definition at line 17305 of file qcustomplot.cpp.

◆ getPixelCoordinates()

QPointF QCPSelectionDecoratorBracket::getPixelCoordinates ( const QCPPlottableInterface1D * interface1d,
int dataIndex ) const
protected

Returns the pixel coordinates of the data point at dataIndex, using interface1d to access the data points.

Definition at line 17404 of file qcustomplot.cpp.

◆ getTangentAngle()

double QCPSelectionDecoratorBracket::getTangentAngle ( const QCPPlottableInterface1D * interface1d,
int dataIndex,
int direction ) const
protected

If setTangentToData is enabled, brackets need to be rotated according to the data slope. This method returns the angle in radians by which a bracket at the given dataIndex must be rotated.

The parameter direction must be set to either -1 or 1, representing whether it is an opening or closing bracket. Since for slope calculation multiple data points are required, this defines the direction in which the algorithm walks, starting at dataIndex, to average those data points. (see setTangentToData and setTangentAverage)

interface1d is the interface to the plottable's data which is used to query data coordinates.

Definition at line 17357 of file qcustomplot.cpp.

◆ setBracketBrush()

void QCPSelectionDecoratorBracket::setBracketBrush ( const QBrush & brush)

Sets the brush that will be used to draw the brackets at the beginning and end of each selected data segment.

Definition at line 17187 of file qcustomplot.cpp.

◆ setBracketHeight()

void QCPSelectionDecoratorBracket::setBracketHeight ( int height)

Sets the height of the drawn bracket. The height dimension is always perpendicular to the key axis of the data, or the tangent direction of the current data slope, if setTangentToData is enabled.

Definition at line 17207 of file qcustomplot.cpp.

◆ setBracketPen()

void QCPSelectionDecoratorBracket::setBracketPen ( const QPen & pen)

Sets the pen that will be used to draw the brackets at the beginning and end of each selected data segment.

Definition at line 17178 of file qcustomplot.cpp.

◆ setBracketStyle()

void QCPSelectionDecoratorBracket::setBracketStyle ( QCPSelectionDecoratorBracket::BracketStyle style)

Sets the shape that the bracket/marker will have.

See also
setBracketWidth, setBracketHeight

Definition at line 17217 of file qcustomplot.cpp.

◆ setBracketWidth()

void QCPSelectionDecoratorBracket::setBracketWidth ( int width)

Sets the width of the drawn bracket. The width dimension is always parallel to the key axis of the data, or the tangent direction of the current data slope, if setTangentToData is enabled.

Definition at line 17197 of file qcustomplot.cpp.

◆ setTangentAverage()

void QCPSelectionDecoratorBracket::setTangentAverage ( int pointCount)

Controls over how many data points the slope shall be averaged, when brackets shall be aligned with the data (if setTangentToData is true).

From the position of the bracket, pointCount points towards the selected data range will be taken into account. The smallest value of pointCount is 1, which is effectively equivalent to disabling setTangentToData.

Definition at line 17242 of file qcustomplot.cpp.

◆ setTangentToData()

void QCPSelectionDecoratorBracket::setTangentToData ( bool enabled)

Sets whether the brackets will be rotated such that they align with the slope of the data at the position that they appear in.

For noisy data, it might be more visually appealing to average the slope over multiple data points. This can be configured via setTangentAverage.

Definition at line 17229 of file qcustomplot.cpp.

◆ tangentAverage()

int QCPSelectionDecoratorBracket::tangentAverage ( ) const
inline

Definition at line 4826 of file qcustomplot.h.

◆ tangentToData()

bool QCPSelectionDecoratorBracket::tangentToData ( ) const
inline

Definition at line 4825 of file qcustomplot.h.

Member Data Documentation

◆ mBracketBrush

QBrush QCPSelectionDecoratorBracket::mBracketBrush
protected

Definition at line 4846 of file qcustomplot.h.

◆ mBracketHeight

int QCPSelectionDecoratorBracket::mBracketHeight
protected

Definition at line 4848 of file qcustomplot.h.

◆ mBracketPen

QPen QCPSelectionDecoratorBracket::mBracketPen
protected

Definition at line 4845 of file qcustomplot.h.

◆ mBracketStyle

BracketStyle QCPSelectionDecoratorBracket::mBracketStyle
protected

Definition at line 4849 of file qcustomplot.h.

◆ mBracketWidth

int QCPSelectionDecoratorBracket::mBracketWidth
protected

Definition at line 4847 of file qcustomplot.h.

◆ mTangentAverage

int QCPSelectionDecoratorBracket::mTangentAverage
protected

Definition at line 4851 of file qcustomplot.h.

◆ mTangentToData

bool QCPSelectionDecoratorBracket::mTangentToData
protected

Definition at line 4850 of file qcustomplot.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:05 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.