QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_SYMBOL_H
28#define QWT_SYMBOL_H
29
30#include "qwt_global.h"
31
32#include <qpolygon.h>
33#include <qpen.h>
34#include <qbrush.h>
35
36class QPainter;
37class QSize;
38class QBrush;
39class QPen;
40class QColor;
41class QPointF;
42class QPainterPath;
43class QPixmap;
44class QByteArray;
45class QwtGraphic;
46
55class QWT_EXPORT QwtSymbol
56{
57 public:
68 enum Style
69 {
71 NoSymbol = -1,
72
75
78
81
84
87
90
93
96
99
102
105
108
111
114
117
131
144
157
170
182 UserStyle = 1000
183 };
184
225 {
228
231
242 AutoCache
243 };
244
245public:
246 // Constructor with style
247 explicit QwtSymbol( Style = NoSymbol );
248 // Constructor with style, brush, pen and size
249 QwtSymbol( Style, const QBrush&, const QPen&, const QSize& );
250 // Constructor with painter path, brush and pen
251 QwtSymbol( const QPainterPath&, const QBrush&, const QPen& );
252
253 // Destructor
254 virtual ~QwtSymbol();
255
256 // Set cache policy
257 void setCachePolicy( CachePolicy );
258 // Get cache policy
259 CachePolicy cachePolicy() const;
260
261 // Set size
262 void setSize( const QSize& );
263 // Set size with width and height
264 void setSize( int width, int height = -1 );
265 // Get size
266 const QSize& size() const;
267
268 // Set pin point
269 void setPinPoint( const QPointF& pos, bool enable = true );
270 // Get pin point
271 QPointF pinPoint() const;
272
273 // Enable/disable pin point
274 void setPinPointEnabled( bool );
275 // Check if pin point is enabled
276 bool isPinPointEnabled() const;
277
278 // Set color
279 virtual void setColor( const QColor& );
280
281 // Set brush
282 void setBrush( const QBrush& );
283 // Get brush
284 const QBrush& brush() const;
285
286 // Set pen with color, width and style
287 void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
288 // Set pen
289 void setPen( const QPen& );
290 // Get pen
291 const QPen& pen() const;
292
293 // Set style
294 void setStyle( Style );
295 // Get style
296 Style style() const;
297
298 // Set painter path
299 void setPath( const QPainterPath& );
300 // Get painter path
301 const QPainterPath& path() const;
302
303 // Set pixmap
304 void setPixmap( const QPixmap& );
305 // Get pixmap
306 const QPixmap& pixmap() const;
307
308 // Set graphic
309 void setGraphic( const QwtGraphic& );
310 // Get graphic
311 const QwtGraphic& graphic() const;
312
313#ifndef QWT_NO_SVG
314 // Set SVG document
315 void setSvgDocument( const QByteArray& );
316#endif
317
318 // Draw symbol in rectangle
319 void drawSymbol( QPainter*, const QRectF& ) const;
320 // Draw symbol at point
321 void drawSymbol( QPainter*, const QPointF& ) const;
322 // Draw symbols at polygon points
323 void drawSymbols( QPainter*, const QPolygonF& ) const;
324 // Draw symbols at points
325 void drawSymbols( QPainter*,
326 const QPointF*, int numPoints ) const;
327
328 // Get bounding rectangle
329 virtual QRect boundingRect() const;
330 // Invalidate cache
331 void invalidateCache();
332
333 protected:
334 virtual void renderSymbols( QPainter*,
335 const QPointF*, int numPoints ) const;
336
337 private:
338 Q_DISABLE_COPY(QwtSymbol)
339
340 class PrivateData;
341 PrivateData* m_data;
342};
343
360 QPainter* painter, const QPointF& pos ) const
361{
362 drawSymbols( painter, &pos, 1 );
363}
364
381 QPainter* painter, const QPolygonF& points ) const
382{
383 drawSymbols( painter, points.data(), points.size() );
384}
385
386#endif
可缩放图形的绘制设备
Definition qwt_graphic.h:128
用于绘制符号的类
Definition qwt_symbol.h:56
void drawSymbol(QPainter *, const QRectF &) const
在矩形中绘制符号
Definition qwt_symbol.cpp:1719
void drawSymbols(QPainter *, const QPolygonF &) const
在指定点处绘制符号
Definition qwt_symbol.h:380
Style
符号样式
Definition qwt_symbol.h:69
@ VLine
垂直线
Definition qwt_symbol.h:107
@ Ellipse
椭圆或圆形
Definition qwt_symbol.h:74
@ LTriangle
向左指向的三角形
Definition qwt_symbol.h:92
@ Star1
X 与 + 组合
Definition qwt_symbol.h:110
@ HLine
水平线
Definition qwt_symbol.h:104
@ Rect
矩形
Definition qwt_symbol.h:77
@ Pixmap
Definition qwt_symbol.h:143
@ Triangle
向上指向的三角形
Definition qwt_symbol.h:83
@ SvgDocument
Definition qwt_symbol.h:169
@ Hexagon
六边形
Definition qwt_symbol.h:116
@ Diamond
菱形
Definition qwt_symbol.h:80
@ Graphic
Definition qwt_symbol.h:156
@ Path
Definition qwt_symbol.h:130
@ XCross
对角十字 (X)
Definition qwt_symbol.h:101
@ Cross
十字 (+)
Definition qwt_symbol.h:98
@ UTriangle
向上指向的三角形
Definition qwt_symbol.h:89
@ DTriangle
向下指向的三角形
Definition qwt_symbol.h:86
@ RTriangle
向右指向的三角形
Definition qwt_symbol.h:95
@ Star2
六角星
Definition qwt_symbol.h:113
CachePolicy
符号渲染的缓存策略
Definition qwt_symbol.h:225
@ NoCache
不使用像素图缓存
Definition qwt_symbol.h:227
@ Cache
始终使用像素图缓存
Definition qwt_symbol.h:230