Qwt User's Guide 6.1.2

- Main Page
- Related Pages
- Classes

All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_symbol.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_SYMBOL_H
11 #define QWT_SYMBOL_H
12
13 #include "qwt_global.h"
14 #include <qpolygon.h>
15
16 class QPainter;
17 class QRect;
18 class QSize;
19 class QBrush;
20 class QPen;
21 class QColor;
22 class QPointF;
23 class QPolygonF;
24 class QPainterPath;
25 class QPixmap;
26 class QByteArray;
27 class QwtGraphic;
28
30 class QWT_EXPORT QwtSymbol
31 {
32 public:
37 enum Style
38 {
40 NoSymbol = -1,
41
43 Ellipse,
44
46 Rect,
47
49 Diamond,
50
52 Triangle,
53
55 DTriangle,
56
58 UTriangle,
59
61 LTriangle,
62
64 RTriangle,
65
67 Cross,
68
70 XCross,
71
73 HLine,
74
76 VLine,
77
79 Star1,
80
82 Star2,
83
85 Hexagon,
86
94 Path,
95
102 Pixmap,
103
110 Graphic,
111
118 SvgDocument,
119
125 UserStyle = 1000
126 };
127
149 enum CachePolicy
150 {
152 NoCache,
153
155 Cache,
156
163 AutoCache
164 };
165
166 public:
167 QwtSymbol( Style = NoSymbol );
168 QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
169 QwtSymbol( const QPainterPath &, const QBrush &, const QPen & );
170
171 virtual ~QwtSymbol();
172
173 void setCachePolicy( CachePolicy );
174 CachePolicy cachePolicy() const;
175
176 void setSize( const QSize & );
177 void setSize( int width, int height = -1 );
178 const QSize& size() const;
179
180 void setPinPoint( const QPointF &pos, bool enable = true );
181 QPointF pinPoint() const;
182
183 void setPinPointEnabled( bool );
184 bool isPinPointEnabled() const;
185
186 virtual void setColor( const QColor & );
187
188 void setBrush( const QBrush& b );
189 const QBrush& brush() const;
190
191 void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
192 void setPen( const QPen & );
193 const QPen& pen() const;
194
195 void setStyle( Style );
196 Style style() const;
197
198 void setPath( const QPainterPath & );
199 const QPainterPath &path() const;
200
201 void setPixmap( const QPixmap & );
202 const QPixmap &pixmap() const;
203
204 void setGraphic( const QwtGraphic & );
205 const QwtGraphic &graphic() const;
206
207 #ifndef QWT_NO_SVG
208 void setSvgDocument( const QByteArray & );
209 #endif
210
211 void drawSymbol( QPainter *, const QRectF & ) const;
212 void drawSymbol( QPainter *, const QPointF & ) const;
213 void drawSymbols( QPainter *, const QPolygonF & ) const;
214 void drawSymbols( QPainter *,
215 const QPointF *, int numPoints ) const;
216
217 virtual QRect boundingRect() const;
218 void invalidateCache();
219
220 protected:
221 virtual void renderSymbols( QPainter *,
222 const QPointF *, int numPoints ) const;
223
224 private:
225 // Disabled copy constructor and operator=
226 QwtSymbol( const QwtSymbol & );
227 QwtSymbol &operator=( const QwtSymbol & );
228
229 class PrivateData;
230 PrivateData *d_data;
231 };
232
239 inline void QwtSymbol::drawSymbol(
240 QPainter *painter, const QPointF &pos ) const
241 {
242 drawSymbols( painter, &pos, 1 );
243 }
244
252 inline void QwtSymbol::drawSymbols(
253 QPainter *painter, const QPolygonF &points ) const
254 {
255 drawSymbols( painter, points.data(), points.size() );
256 }
257
258 #endif
QwtSymbol::Hexagon
Hexagon.
Definition: qwt_symbol.h:85
QwtSymbol::Star2
Six-pointed star.
Definition: qwt_symbol.h:82
QwtSymbol::drawSymbol
void drawSymbol(QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
Definition: qwt_symbol.cpp:1406
QwtSymbol::Ellipse
Ellipse or circle.
Definition: qwt_symbol.h:43
QwtSymbol::HLine
Horizontal line.
Definition: qwt_symbol.h:73
QwtSymbol::UTriangle
Triangle pointing upwards.
Definition: qwt_symbol.h:58
QwtSymbol::DTriangle
Triangle pointing downwards.
Definition: qwt_symbol.h:55
QwtSymbol::Triangle
Triangle pointing upwards.
Definition: qwt_symbol.h:52
QwtSymbol::Cross
Cross (+)
Definition: qwt_symbol.h:67
QwtSymbol
A class for drawing symbols.
Definition: qwt_symbol.h:30
QwtSymbol::Cache
Always use a pixmap cache.
Definition: qwt_symbol.h:155
QwtSymbol::SvgDocument
Definition: qwt_symbol.h:118
QwtSymbol::CachePolicy
CachePolicy
Definition: qwt_symbol.h:149
QwtSymbol::NoCache
Don&#39;t use a pixmap cache.
Definition: qwt_symbol.h:152
QwtSymbol::XCross
Diagonal cross (X)
Definition: qwt_symbol.h:70
QwtSymbol::drawSymbols
void drawSymbols(QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
Definition: qwt_symbol.h:252
QwtSymbol::Pixmap
Definition: qwt_symbol.h:102
QwtSymbol::Star1
X combined with +.
Definition: qwt_symbol.h:79
QwtSymbol::RTriangle
Triangle pointing right.
Definition: qwt_symbol.h:64
QwtSymbol::LTriangle
Triangle pointing left.
Definition: qwt_symbol.h:61
QwtSymbol::Rect
Rectangle.
Definition: qwt_symbol.h:46
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
QwtSymbol::Style
Style
Definition: qwt_symbol.h:37
QwtSymbol::Graphic
Definition: qwt_symbol.h:110
QwtSymbol::Path
Definition: qwt_symbol.h:94
QwtSymbol::VLine
Vertical line.
Definition: qwt_symbol.h:76
QwtSymbol::Diamond
Diamond.
Definition: qwt_symbol.h:49