Qwt User's Guide  6.1.1
 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 
44 
47 
50 
53 
56 
59 
62 
65 
68 
71 
74 
77 
80 
83 
86 
95 
103 
111 
119 
125  UserStyle = 1000
126  };
127 
150  {
153 
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 
240  QPainter *painter, const QPointF &pos ) const
241 {
242  drawSymbols( painter, &pos, 1 );
243 }
244 
253  QPainter *painter, const QPolygonF &points ) const
254 {
255  drawSymbols( painter, points.data(), points.size() );
256 }
257 
258 #endif
Hexagon.
Definition: qwt_symbol.h:85
Six-pointed star.
Definition: qwt_symbol.h:82
void drawSymbol(QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
Definition: qwt_symbol.cpp:1406
Ellipse or circle.
Definition: qwt_symbol.h:43
Horizontal line.
Definition: qwt_symbol.h:73
Triangle pointing upwards.
Definition: qwt_symbol.h:58
Triangle pointing downwards.
Definition: qwt_symbol.h:55
Triangle pointing upwards.
Definition: qwt_symbol.h:52
Cross (+)
Definition: qwt_symbol.h:67
A class for drawing symbols.
Definition: qwt_symbol.h:30
Always use a pixmap cache.
Definition: qwt_symbol.h:155
Definition: qwt_symbol.h:118
CachePolicy
Definition: qwt_symbol.h:149
Don&#39;t use a pixmap cache.
Definition: qwt_symbol.h:152
Diagonal cross (X)
Definition: qwt_symbol.h:70
void drawSymbols(QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
Definition: qwt_symbol.h:252
Definition: qwt_symbol.h:102
X combined with +.
Definition: qwt_symbol.h:79
Triangle pointing right.
Definition: qwt_symbol.h:64
Triangle pointing left.
Definition: qwt_symbol.h:61
Rectangle.
Definition: qwt_symbol.h:46
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
Style
Definition: qwt_symbol.h:37
Definition: qwt_symbol.h:110
Definition: qwt_symbol.h:94
Vertical line.
Definition: qwt_symbol.h:76
Diamond.
Definition: qwt_symbol.h:49