Qwt User's Guide: qwt_symbol.h Source File

Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_symbol.h
1/******************************************************************************
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
15#include <qpolygon.h>
16#include <qpen.h>
17#include <qbrush.h>
18
19class QPainter;
20class QSize;
21class QBrush;
22class QPen;
23class QColor;
24class QPointF;
25class QPainterPath;
26class QPixmap;
27class QByteArray;
28class QwtGraphic;
29
31 class QWT_EXPORT QwtSymbol
32{
33 public:
38 enum Style
39 {
41 NoSymbol = -1,
42
44 Ellipse,
45
47 Rect,
48
50 Diamond,
51
53 Triangle,
54
56 DTriangle,
57
59 UTriangle,
60
62 LTriangle,
63
65 RTriangle,
66
68 Cross,
69
71 XCross,
72
74 HLine,
75
77 VLine,
78
80 Star1,
81
83 Star2,
84
86 Hexagon,
87
95 Path,
96
103 Pixmap,
104
111 Graphic,
112
119 SvgDocument,
120
126 UserStyle = 1000
127 };
128
150 enum CachePolicy
151 {
153 NoCache,
154
156 Cache,
157
164 AutoCache
165 };
166
167 public:
168 explicit QwtSymbol( Style = NoSymbol );
169 QwtSymbol( Style, const QBrush&, const QPen&, const QSize& );
170 QwtSymbol( const QPainterPath&, const QBrush&, const QPen& );
171
172 virtual ~QwtSymbol();
173
174 void setCachePolicy( CachePolicy );
175 CachePolicy cachePolicy() const;
176
177 void setSize( const QSize& );
178 void setSize( int width, int height = -1 );
179 const QSize& size() const;
180
181 void setPinPoint( const QPointF& pos, bool enable = true );
182 QPointF pinPoint() const;
183
184 void setPinPointEnabled( bool );
185 bool isPinPointEnabled() const;
186
187 virtual void setColor( const QColor& );
188
189 void setBrush( const QBrush& );
190 const QBrush& brush() const;
191
192 void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
193 void setPen( const QPen& );
194 const QPen& pen() const;
195
196 void setStyle( Style );
197 Style style() const;
198
199 void setPath( const QPainterPath& );
200 const QPainterPath& path() const;
201
202 void setPixmap( const QPixmap& );
203 const QPixmap& pixmap() const;
204
205 void setGraphic( const QwtGraphic& );
206 const QwtGraphic& graphic() const;
207
208#ifndef QWT_NO_SVG
209 void setSvgDocument( const QByteArray& );
210#endif
211
212 void drawSymbol( QPainter*, const QRectF& ) const;
213 void drawSymbol( QPainter*, const QPointF& ) const;
214 void drawSymbols( QPainter*, const QPolygonF& ) const;
215 void drawSymbols( QPainter*,
216 const QPointF*, int numPoints ) const;
217
218 virtual QRect boundingRect() const;
219 void invalidateCache();
220
221 protected:
222 virtual void renderSymbols( QPainter*,
223 const QPointF*, int numPoints ) const;
224
225 private:
226 Q_DISABLE_COPY(QwtSymbol)
227
228 class PrivateData;
229 PrivateData* m_data;
230};
231
238 inline void QwtSymbol::drawSymbol(
239 QPainter* painter, const QPointF& pos ) const
240{
241 drawSymbols( painter, &pos, 1 );
242}
243
251 inline void QwtSymbol::drawSymbols(
252 QPainter* painter, const QPolygonF& points ) const
253{
254 drawSymbols( painter, points.data(), points.size() );
255}
256
257#endif
QwtGraphic
A paint device for scalable graphics.
Definition qwt_graphic.h:76
QwtSymbol
A class for drawing symbols.
Definition qwt_symbol.h:32
QwtSymbol::drawSymbol
void drawSymbol(QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
Definition qwt_symbol.cpp:1434
QwtSymbol::drawSymbols
void drawSymbols(QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
Definition qwt_symbol.h:251
QwtSymbol::Style
Style
Definition qwt_symbol.h:39
QwtSymbol::VLine
@ VLine
Vertical line.
Definition qwt_symbol.h:77
QwtSymbol::Ellipse
@ Ellipse
Ellipse or circle.
Definition qwt_symbol.h:44
QwtSymbol::LTriangle
@ LTriangle
Triangle pointing left.
Definition qwt_symbol.h:62
QwtSymbol::Star1
@ Star1
X combined with +.
Definition qwt_symbol.h:80
QwtSymbol::HLine
@ HLine
Horizontal line.
Definition qwt_symbol.h:74
QwtSymbol::Rect
@ Rect
Rectangle.
Definition qwt_symbol.h:47
QwtSymbol::Pixmap
@ Pixmap
Definition qwt_symbol.h:103
QwtSymbol::Triangle
@ Triangle
Triangle pointing upwards.
Definition qwt_symbol.h:53
QwtSymbol::SvgDocument
@ SvgDocument
Definition qwt_symbol.h:119
QwtSymbol::Hexagon
@ Hexagon
Hexagon.
Definition qwt_symbol.h:86
QwtSymbol::Diamond
@ Diamond
Diamond.
Definition qwt_symbol.h:50
QwtSymbol::Graphic
@ Graphic
Definition qwt_symbol.h:111
QwtSymbol::Path
@ Path
Definition qwt_symbol.h:95
QwtSymbol::XCross
@ XCross
Diagonal cross (X)
Definition qwt_symbol.h:71
QwtSymbol::Cross
@ Cross
Cross (+)
Definition qwt_symbol.h:68
QwtSymbol::UTriangle
@ UTriangle
Triangle pointing upwards.
Definition qwt_symbol.h:59
QwtSymbol::DTriangle
@ DTriangle
Triangle pointing downwards.
Definition qwt_symbol.h:56
QwtSymbol::RTriangle
@ RTriangle
Triangle pointing right.
Definition qwt_symbol.h:65
QwtSymbol::Star2
@ Star2
Six-pointed star.
Definition qwt_symbol.h:83
QwtSymbol::CachePolicy
CachePolicy
Definition qwt_symbol.h:151
QwtSymbol::NoCache
@ NoCache
Don't use a pixmap cache.
Definition qwt_symbol.h:153
QwtSymbol::Cache
@ Cache
Always use a pixmap cache.
Definition qwt_symbol.h:156