# QwtSymbol Class Reference

List of all members.

## Detailed Description

A class for drawing symbols.

Definition at line 22 of file qwt_symbol.h.

## Public Types

enum | Style { NoSymbol = -1, Ellipse, Rect, Diamond, Triangle, DTriangle, UTriangle, LTriangle, RTriangle, Cross, XCross, HLine, VLine, Star1, Star2, Hexagon, StyleCnt }

## Public Member Functions

| QwtSymbol ()
| QwtSymbol (Style st, const QBrush &bd, const QPen &pn, const QSize &s)
virtual | ~QwtSymbol ()
bool | operator!= (const QwtSymbol &) const
bool | operator== (const QwtSymbol &) const
void | setSize (const QSize &s)
void | setSize (int a, int b=-1)
void | setBrush (const QBrush &b)
void | setPen (const QPen &p)
void | setStyle (Style s)
const QBrush & | brush () const
const QPen & | pen () const
const QSize & | size () const
Style | style () const
void | draw (QPainter *p, const QPoint &pt) const
void | draw (QPainter *p, int x, int y) const
virtual void | draw (QPainter *p, const QRect &r) const

## Member Enumeration Documentation

enum QwtSymbol::Style

Style

See also:
  QwtSymbol::setStyle, QwtSymbol::style

Definition at line 29 of file qwt_symbol.h.

## Constructor & Destructor Documentation

QwtSymbol::QwtSymbol | ( |  | ) |

| Default Constructor The symbol is constructed with gray interior, black outline with zero width, no size and style 'NoSymbol'. Definition at line 22 of file qwt_symbol.cpp.

QwtSymbol::QwtSymbol | ( | QwtSymbol::Style | style,
|  | const QBrush & | brush,
|  | const QPen & | pen,
|  | const QSize & | size
| ) |

Constructor.

Parameters:

  | style | Symbol Style
  | brush | brush to fill the interior
  | pen | outline pen
  | size | size

Definition at line 37 of file qwt_symbol.cpp.

QwtSymbol::~QwtSymbol | ( |  | ) | `[virtual]`

| Destructor. Definition at line 47 of file qwt_symbol.cpp.

## Member Function Documentation

const QBrush& QwtSymbol::brush | ( |  | ) | const`[inline]`

| Return Brush. Definition at line 67 of file qwt_symbol.h. Referenced by QwtPlotCurve::drawSymbols(), and operator==().

void QwtSymbol::draw | ( | QPainter * | painter,
|  | const QRect & | r
| ) | const`[virtual]`

Draw the symbol into a bounding rectangle.

This function assumes that the painter has been initialized with brush and pen before. This allows a much more performant implementation when painting many symbols with the same brush and pen like in curves.

Parameters:

  | painter | Painter
  | r | Bounding rectangle

Definition at line 116 of file qwt_symbol.cpp.

References QwtPainter::drawEllipse(), QwtPainter::drawLine(), QwtPainter::drawPolygon(), and QwtPainter::drawRect().

void QwtSymbol::draw | ( | QPainter * | p,
|  | int | x,
|  | int | y
| ) | const

| Draw the symbol at a point (x,y). Definition at line 100 of file qwt_symbol.cpp. References draw().

void QwtSymbol::draw | ( | QPainter * | painter,
|  | const QPoint & | pos
| ) | const

Draw the symbol at a specified point.

Parameters:

  | painter | Painter
  | pos | Center of the symbol

Definition at line 294 of file qwt_symbol.cpp.

References QwtPainter::metricsMap().

Referenced by draw(), and QwtPlotCurve::drawSymbols().

bool QwtSymbol::operator!= | ( | const QwtSymbol & |  | ) | const

| != operator Definition at line 342 of file qwt_symbol.cpp.

bool QwtSymbol::operator== | ( | const QwtSymbol & |  | ) | const

| == operator Definition at line 335 of file qwt_symbol.cpp. References brush(), pen(), size(), and style().

const QPen& QwtSymbol::pen | ( |  | ) | const`[inline]`

| Return Pen. Definition at line 69 of file qwt_symbol.h. Referenced by QwtPlotCurve::drawSymbols(), and operator==().

void QwtSymbol::setBrush | ( | const QBrush & | br | ) |

Assign a brush.

The brush is used to draw the interior of the symbol.

Parameters:

  | br | brush

Definition at line 80 of file qwt_symbol.cpp.

void QwtSymbol::setPen | ( | const QPen & | pn | ) |

Assign a pen.

The pen is used to draw the symbol's outline.

Parameters:

  | pn | pen

Definition at line 92 of file qwt_symbol.cpp.

void QwtSymbol::setSize | ( | int | w,
|  | int | h = `-1`
| ) |

Specify the symbol's size.

If the 'h' parameter is left out or less than 0, and the 'w' parameter is greater than or equal to 0, the symbol size will be set to (w,w).

Parameters:

  | w | width
  | h | height (defaults to -1)

Definition at line 60 of file qwt_symbol.cpp.

void QwtSymbol::setSize | ( | const QSize & | s | ) |

| Set the symbol's size. Definition at line 68 of file qwt_symbol.cpp.

void QwtSymbol::setStyle | ( | QwtSymbol::Style | s | ) |

Specify the symbol style.

The following styles are defined:

NoSymbol
  No Style. The symbol cannot be drawn.
Ellipse
  Ellipse or circle
Rect
  Rectangle
Diamond
  Diamond
Triangle
  Triangle pointing upwards
DTriangle
  Triangle pointing downwards
UTriangle
  Triangle pointing upwards
LTriangle
  Triangle pointing left
RTriangle
  Triangle pointing right
Cross
  Cross (+)
XCross
  Diagonal cross (X)
HLine
  Horizontal line
VLine
  Vertical line
Star1
  X combined with +
Star2
  Six-pointed star
Hexagon
  Hexagon

Parameters:

  | s | style

Definition at line 329 of file qwt_symbol.cpp.

const QSize& QwtSymbol::size | ( |  | ) | const`[inline]`

| Return Size. Definition at line 71 of file qwt_symbol.h. Referenced by QwtPlotCurve::drawSymbols(), and operator==().

Style QwtSymbol::style | ( |  | ) | const`[inline]`

| Return Style. Definition at line 73 of file qwt_symbol.h. Referenced by operator==().