Qwt User's Guide: QwtSymbol Class Reference

Qwt User's Guide 6.0.1

- Main Page
- Related Pages
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Member Functions

# QwtSymbol Class Reference

A class for drawing symbols. More...

`#include <qwt_symbol.h>`

List of all members.

## Public Types
enum | Style { NoSymbol = -1, Ellipse, Rect, Diamond, Triangle, DTriangle, UTriangle, LTriangle, RTriangle, Cross, XCross, HLine, VLine, Star1, Star2, Hexagon, UserStyle = 1000 }
## Public Member Functions
virtual QSize | boundingSize () const
const QBrush & | brush () const
void | drawSymbol (QPainter *, const QPointF &) const
void | drawSymbols (QPainter *, const QPolygonF &) const
bool | operator!= (const QwtSymbol &) const
QwtSymbol & | operator= (const QwtSymbol &)
bool | operator== (const QwtSymbol &) const
const QPen & | pen () const
| QwtSymbol (Style=NoSymbol)
| QwtSymbol (Style, const QBrush &, const QPen &, const QSize &)
| QwtSymbol (const QwtSymbol &)
void | setBrush (const QBrush &b)
virtual void | setColor (const QColor &)
void | setPen (const QPen &)
void | setSize (const QSize &)
void | setSize (int width, int height=-1)
void | setStyle (Style)
const QSize & | size () const
Style | style () const
virtual | ~QwtSymbol ()
## Protected Member Functions
virtual void | drawSymbols (QPainter *, const QPointF *, int numPoints) const

## Detailed Description

A class for drawing symbols.

## Member Enumeration Documentation

enum QwtSymbol::Style

Symbol Style

See also:
  setStyle(), style()

Enumerator:

  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.
  UserStyle | Styles >= QwtSymbol::UserSymbol are reserved for derived classes of QwtSymbol that overload drawSymbols() with additional application specific symbol types.

## Constructor & Destructor Documentation

QwtSymbol::QwtSymbol | ( | Style | style = `NoSymbol` | ) |

Default Constructor

Parameters:

  style | Symbol Style

The symbol is constructed with gray interior, black outline with zero width, no size and style 'NoSymbol'.

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

See also:
  setStyle(), setBrush(), setPen(), setSize()

QwtSymbol::QwtSymbol | ( | const QwtSymbol & | other | ) |

Copy constructor.

Parameters:

  other | Symbol

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

Destructor.

## Member Function Documentation

QSize QwtSymbol::boundingSize | ( |  | ) | const`[virtual]`

Returns:
  Size of the bounding rectangle of a symbol

const QBrush & QwtSymbol::brush | ( |  | ) | const

Returns:
  Brush

See also:
  setBrush()

void QwtSymbol::drawSymbol | ( | QPainter * | painter,
|  | const QPointF & | pos
| ) |  | const`[inline]`

Draw the symbol at a specified position.

Parameters:

  painter | Painter
  pos | Position of the symbol in screen coordinates

void QwtSymbol::drawSymbols | ( | QPainter * | painter,
|  | const QPointF * | points,
|  | int | numPoints
| ) |  | const`[protected, virtual]`

Draw an array of symbols

Painting several symbols is more effective than drawing symbols one by one, as a couple of layout calculations and setting of pen/brush can be done once for the complete array.

Parameters:

  painter | Painter
  points | Array of points
  numPoints | Number of points

void QwtSymbol::drawSymbols | ( | QPainter * | painter,
|  | const QPolygonF & | points
| ) |  | const`[inline]`

Draw symbols at the specified points.

Parameters:

  painter | Painter
  points | Positions of the symbols in screen coordinates

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

Compare two symbols.

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

Assignment operator.

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

Compare two symbols.

const QPen & QwtSymbol::pen | ( |  | ) | const

Returns:
  Pen

See also:
  setPen(), brush()

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

Assign a brush.

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

Parameters:

  brush | Brush

See also:
  brush()

void QwtSymbol::setColor | ( | const QColor & | color | ) | `[virtual]`

Set the color of the symbol.

Change the color of the brush for symbol types with a filled area. For all other symbol types the color will be assigned to the pen.

Parameters:

  color | Color

See also:
  setBrush(), setPen(), brush(), pen()

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

Assign a pen

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

Parameters:

  pen | Pen

See also:
  pen(), setBrush()

void QwtSymbol::setSize | ( | int | width,
|  | int | height = `-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:

  width | Width
  height | Height (defaults to -1)

See also:
  size()

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

Set the symbol's size

Parameters:

  size | Size

See also:
  size()

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

Specify the symbol style

Parameters:

  style | Style

See also:
  style()

const QSize & QwtSymbol::size | ( |  | ) | const

Returns:
  Size

See also:
  setSize()

QwtSymbol::Style QwtSymbol::style | ( |  | ) | const

Returns:
  Current symbol style

See also:
  setStyle()