Qwt User's Guide
svn
|
#include <qwt_symbol.h>
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 |
A class for drawing symbols.
enum QwtSymbol::Style |
Symbol Style
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. |
QwtSymbol::QwtSymbol | ( | Style | style = NoSymbol | ) |
Default Constructor
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.
style | Symbol Style |
brush | brush to fill the interior |
pen | outline pen |
size | size |
QwtSymbol::QwtSymbol | ( | const QwtSymbol & | other | ) |
Copy constructor.
other | Symbol |
QwtSymbol::~QwtSymbol | ( | ) | [virtual] |
Destructor.
QSize QwtSymbol::boundingSize | ( | ) | const [virtual] |
const QBrush & QwtSymbol::brush | ( | ) | const |
void QwtSymbol::drawSymbol | ( | QPainter * | painter, |
const QPointF & | pos | ||
) | const [inline] |
Draw the symbol at a specified position.
painter | Painter |
pos | Position of the symbol in screen coordinates |
void QwtSymbol::drawSymbols | ( | QPainter * | painter, |
const QPolygonF & | points | ||
) | const [inline] |
Draw symbols at the specified points.
painter | Painter |
points | Positions of the symbols 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.
painter | Painter |
points | Array of points |
numPoints | Number of points |
bool QwtSymbol::operator!= | ( | const QwtSymbol & | other | ) | const |
Compare two symbols.
bool QwtSymbol::operator== | ( | const QwtSymbol & | other | ) | const |
Compare two symbols.
void QwtSymbol::setBrush | ( | const QBrush & | brush | ) |
Assign a brush.
The brush is used to draw the interior of the symbol.
brush | 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.
color | Color |
void QwtSymbol::setPen | ( | const QPen & | pen | ) |
Assign a pen
The pen is used to draw the symbol's outline.
pen | Pen |
void QwtSymbol::setSize | ( | const QSize & | size | ) |
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).
width | Width |
height | Height (defaults to -1) |
void QwtSymbol::setStyle | ( | QwtSymbol::Style | style | ) |
const QSize & QwtSymbol::size | ( | ) | const |
QwtSymbol::Style QwtSymbol::style | ( | ) | const |