.Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
QCPlot::QCPLineEnding Class Reference

Handles the different ending decorations for line-like items. More...

Public Types

enum  EndingStyle {
  esNone, esFlatArrow, esSpikeArrow, esLineArrow,
  esDisc, esSquare, esDiamond, esBar
}
 Defines the type of ending decoration for line-like items, e.g. More...
 

Public Member Functions

 QCPLineEnding ()
 Creates a QCPLineEnding instance with default values (style esNone).
 
 QCPLineEnding (EndingStyle style, double width=8, double length=10, bool inverted=false)
 Creates a QCPLineEnding instance with the specified values.
 
EndingStyle style () const
 
double width () const
 
double length () const
 
bool inverted () const
 
void setStyle (EndingStyle style)
 Sets the style of the ending decoration.
 
void setWidth (double width)
 Sets the width of the ending decoration, if the style supports it. More...
 
void setLength (double length)
 Sets the length of the ending decoration, if the style supports it. More...
 
void setInverted (bool inverted)
 Sets whether the direction of the ending decoration shall be inverted with respect to the natural direction given by the parent item. More...
 
double boundingDistance () const
 
void draw (QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const
 
void draw (QCPPainter *painter, const QVector2D &pos, double angle) const
 

Protected Attributes

EndingStyle mStyle
 
double mWidth
 
double mLength
 
bool mInverted
 

Detailed Description

Handles the different ending decorations for line-like items.

QCPLineEnding.png
The various ending styles currently supported

For every ending a line-like item has, an instance of this class exists. For example, QCPItemLine has two endings which can be set with QCPItemLine::setHead and QCPItemLine::setTail.

The styles themselves are defined via the enum QCPLineEnding::EndingStyle. Most decorations can be modified regarding width and length, see setWidth and setLength. The direction of the ending decoration (e.g. direction an arrow is pointing) is controlled by the line-like item. For example, when both endings of a QCPItemLine are set to be arrows, they will point to opposite directions, e.g. "outward". This can be changed by setInverted, which would make the respective arrow point inward.

Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle where actually a QCPLineEnding is expected, e.g.

myItemLine->setHead(QCPLineEnding::esSpikeArrow)

Member Enumeration Documentation

Defines the type of ending decoration for line-like items, e.g.

an arrow.

QCPLineEnding.png

The width and length of these decorations can be controlled with the functions setWidth and setLength. Some decorations like esDisc, esSquare, esDiamond and esBar only support a width, the length property is ignored.

See Also
QCPItemLine::setHead, QCPItemLine::setTail, QCPItemCurve::setHead, QCPItemCurve::setTail
Enumerator
esNone 

No ending decoration.

esFlatArrow 

A filled arrow head with a straight/flat back (a triangle)

esSpikeArrow 

A filled arrow head with an indented back.

esLineArrow 

A non-filled arrow head with open back.

esDisc 

A filled circle.

esSquare 

A filled square.

esDiamond 

A filled diamond (45° rotated square)

esBar 

A bar perpendicular to the line.

Member Function Documentation

void QCPlot::QCPLineEnding::setInverted ( bool  inverted)

Sets whether the direction of the ending decoration shall be inverted with respect to the natural direction given by the parent item.

For example, an arrow decoration will point inward when inverted is set to true.

void QCPlot::QCPLineEnding::setLength ( double  length)

Sets the length of the ending decoration, if the style supports it.

On arrows, for example, the length defines the size in pointing direction.

See Also
setWidth
void QCPlot::QCPLineEnding::setWidth ( double  width)

Sets the width of the ending decoration, if the style supports it.

On arrows, for example, the width defines the size perpendicular to the arrow's pointing direction.

See Also
setLength

The documentation for this class was generated from the following files: