Qwt User's Guide
6.0.2
|
#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 | |
QwtSymbol (Style=NoSymbol) | |
QwtSymbol (Style, const QBrush &, const QPen &, const QSize &) | |
QwtSymbol (const QwtSymbol &) | |
virtual | ~QwtSymbol () |
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 |
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 |
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. |
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 |
|
virtual |
const QBrush & QwtSymbol::brush | ( | ) | const |
|
inline |
Draw the symbol at a specified position.
painter | Painter |
pos | Position of the symbol in screen coordinates |
|
inline |
Draw symbols at the specified points.
painter | Painter |
points | Positions of the symbols in screen coordinates |
|
protectedvirtual |
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 |
void QwtSymbol::setBrush | ( | const QBrush & | brush | ) |
Assign a brush.
The brush is used to draw the interior of the symbol.
brush | Brush |
|
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 |