QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_shapeitem.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_PLOT_SHAPE_ITEM_H
28#define QWT_PLOT_SHAPE_ITEM_H
29
30#include "qwt_global.h"
31#include "qwt_plot_item.h"
32
33#include <qstring.h>
34
35class QPainterPath;
36class QPolygonF;
37
68class QWT_EXPORT QwtPlotShapeItem : public QwtPlotItem
69{
70public:
87 {
106 ClipPolygons = 0x01,
107 };
108
109 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
110
111
123 {
126
128 LegendColor
129 };
130
131 // Constructor
132 explicit QwtPlotShapeItem(const QString& title = QString());
133 // Constructor with title
134 explicit QwtPlotShapeItem(const QwtText& title);
135
136 // Destructor
137 virtual ~QwtPlotShapeItem();
138
139 // Set a paint attribute
140 void setPaintAttribute(PaintAttribute, bool on = true);
141 // Test a paint attribute
142 bool testPaintAttribute(PaintAttribute) const;
143
144 // Set the legend mode
145 void setLegendMode(LegendMode);
146 // Get the legend mode
147 LegendMode legendMode() const;
148
149 // Set the shape as a rectangle
150 void setRect(const QRectF&);
151 // Set the shape as a polygon
152 void setPolygon(const QPolygonF&);
153
154 // Set the shape
155 void setShape(const QPainterPath&);
156 // Get the shape
157 QPainterPath shape() const;
158
159 // Set the pen
160 void setPen(const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine);
161 // Set the pen
162 void setPen(const QPen&);
163 // Get the pen
164 QPen pen() const;
165
166 // Set the brush
167 void setBrush(const QBrush&);
168 // Get the brush
169 QBrush brush() const;
170
171 // Set the render tolerance
172 void setRenderTolerance(double);
173 // Get the render tolerance
174 double renderTolerance() const;
175
176 // Get the bounding rectangle
177 virtual QRectF boundingRect() const override;
178
179 // Draw the shape item
180 virtual void draw(QPainter*, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect) const override;
181
182 // Get the legend icon
183 virtual QwtGraphic legendIcon(int index, const QSizeF&) const override;
184
185 // Get the runtime type information
186 virtual int rtti() const override;
187
188private:
194 void init();
195
196 class PrivateData;
197 PrivateData* m_data;
198};
199
200#endif
可缩放图形的绘制设备
Definition qwt_graphic.h:128
绘图画布上项目的基类
Definition qwt_plot_item.h:119
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
绘制项目
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
Return a legend icon
Definition qwt_plot_item.cpp:621
virtual int rtti() const
Runtime type information
Definition qwt_plot_item.cpp:215
virtual QRectF boundingRect() const
Get the bounding rectangle
Definition qwt_plot_item.cpp:883
显示可由 QPainterPath 定义的任何图形形状的绘图项
Definition qwt_plot_shapeitem.h:69
LegendMode
图例模式
Definition qwt_plot_shapeitem.h:123
@ LegendShape
Display a scaled down version of the shape
Definition qwt_plot_shapeitem.h:125
PaintAttribute
绘制属性
Definition qwt_plot_shapeitem.h:87
刻度映射
Definition qwt_scale_map.h:52
表示文本的类
Definition qwt_text.h:93