QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_item.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_ITEM_H
28#define QWT_PLOT_ITEM_H
29
30#include "qwt_global.h"
31#include "qwt_axis_id.h"
32#include <qmetatype.h>
33
34class QwtScaleMap;
35class QwtScaleDiv;
36class QwtPlot;
37class QwtText;
38class QwtGraphic;
39class QwtLegendData;
40class QRectF;
41class QPainter;
42class QString;
43template< typename T >
44class QList;
45
84class QWT_EXPORT QwtPlotItem
85{
86public:
161
172 {
174 Legend = 0x01,
175
181 AutoScale = 0x02,
182
188 Margins = 0x04
189 };
190
191 Q_DECLARE_FLAGS(ItemAttributes, ItemAttribute)
192
193
202 {
207 ScaleInterest = 0x01,
208
216 LegendInterest = 0x02
217 };
218
219 Q_DECLARE_FLAGS(ItemInterests, ItemInterest)
220
221
225 {
227 RenderAntialiased = 0x1
228 };
229
230 Q_DECLARE_FLAGS(RenderHints, RenderHint)
231
232
233 explicit QwtPlotItem();
235 explicit QwtPlotItem(const QString& title);
237 explicit QwtPlotItem(const QwtText& title);
238
240 virtual ~QwtPlotItem();
241
243 virtual void attach(QwtPlot* plot);
245 void detach();
246
248 QwtPlot* plot() const;
249
251 void setTitle(const QString& title);
253 void setTitle(const QwtText& title);
255 const QwtText& title() const;
256
258 virtual int rtti() const;
259
261 void setItemAttribute(ItemAttribute, bool on = true);
263 bool testItemAttribute(ItemAttribute) const;
264
266 void setItemInterest(ItemInterest, bool on = true);
268 bool testItemInterest(ItemInterest) const;
269
271 void setRenderHint(RenderHint, bool on = true);
273 bool testRenderHint(RenderHint) const;
274
276 void setRenderThreadCount(uint numThreads);
278 uint renderThreadCount() const;
279
281 void setLegendIconSize(const QSize&);
283 QSize legendIconSize() const;
284
286 double z() const;
288 void setZ(double z);
289
291 void show();
293 void hide();
295 virtual void setVisible(bool);
297 bool isVisible() const;
298
300 void setAxes(QwtAxisId xAxis, QwtAxisId yAxis);
301
303 void setXAxis(QwtAxisId);
305 QwtAxisId xAxis() const;
306
308 void setYAxis(QwtAxisId);
310 QwtAxisId yAxis() const;
311
313 virtual void itemChanged();
315 virtual void legendChanged();
316
325 virtual void draw(QPainter* painter, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect) const = 0;
326
328 virtual QRectF boundingRect() const;
329
331 virtual void getCanvasMarginHint(const QwtScaleMap& xMap,
332 const QwtScaleMap& yMap,
333 const QRectF& canvasRect,
334 double& left,
335 double& top,
336 double& right,
337 double& bottom) const;
338
340 virtual void updateScaleDiv(const QwtScaleDiv&, const QwtScaleDiv&);
341
343 virtual void updateLegend(const QwtPlotItem*, const QList< QwtLegendData >&);
344
346 QRectF scaleRect(const QwtScaleMap&, const QwtScaleMap&) const;
348 QRectF paintRect(const QwtScaleMap&, const QwtScaleMap&) const;
349
351 virtual QList< QwtLegendData > legendData() const;
352
354 virtual QwtGraphic legendIcon(int index, const QSizeF&) const;
355
356protected:
358 QwtGraphic defaultIcon(const QBrush&, const QSizeF&) const;
359
360private:
361 QwtPlotItem(const QwtPlotItem&) = delete;
362 QwtPlotItem& operator=(const QwtPlotItem&) = delete;
363 QWT_DECLARE_PRIVATE(QwtPlotItem)
364};
365
366Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotItem::ItemAttributes)
367Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotItem::ItemInterests)
368Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotItem::RenderHints)
369
370Q_DECLARE_METATYPE(QwtPlotItem*)
371
372#endif
Definition qwt_raster_data.h:38
A paint device for scalable graphics
Definition qwt_graphic.h:85
Attributes of an entry on a legend
Definition qwt_legend_data.h:49
Base class for items on the plot canvas
Definition qwt_plot_item.h:85
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item
QwtPlotItem(const QwtText &title)
Constructor with title as QwtText
virtual ~QwtPlotItem()
Destructor
RttiValues
Runtime type information
Definition qwt_plot_item.h:94
@ Rtti_PlotVectorField
For QwtPlotVectorField
Definition qwt_plot_item.h:147
@ Rtti_PlotLegend
For QwtPlotLegendItem
Definition qwt_plot_item.h:105
@ Rtti_PlotMarker
For QwtPlotMarker
Definition qwt_plot_item.h:108
@ Rtti_PlotSpectroCurve
For QwtPlotSpectroCurve
Definition qwt_plot_item.h:114
@ Rtti_PlotScale
For QwtPlotScaleItem
Definition qwt_plot_item.h:102
@ Rtti_PlotArrowMarker
For QwtPlotArrowMarker
Definition qwt_plot_item.h:150
@ Rtti_PlotHistogram
For QwtPlotHistogram
Definition qwt_plot_item.h:120
@ Rtti_PlotZone
For QwtPlotZoneItem
Definition qwt_plot_item.h:144
@ Rtti_PlotIntervalCurve
For QwtPlotIntervalCurve
Definition qwt_plot_item.h:117
@ Rtti_PlotMultiBarChart
For QwtPlotMultiBarChart
Definition qwt_plot_item.h:135
@ Rtti_PlotBarChart
For QwtPlotBarChart
Definition qwt_plot_item.h:132
@ Rtti_PlotTradingCurve
For QwtPlotTradingCurve
Definition qwt_plot_item.h:129
@ Rtti_PlotBoxChart
Boxplot chart item
Definition qwt_plot_item.h:153
@ Rtti_PlotSpectrogram
For QwtPlotSpectrogram
Definition qwt_plot_item.h:123
@ Rtti_PlotTextLabel
For QwtPlotTextLabel
Definition qwt_plot_item.h:141
@ Rtti_PlotShape
For QwtPlotShapeItem
Definition qwt_plot_item.h:138
@ Rtti_PlotGrid
For QwtPlotGrid
Definition qwt_plot_item.h:99
@ Rtti_PlotCurve
For QwtPlotCurve
Definition qwt_plot_item.h:111
@ Rtti_PlotGraphic
For QwtPlotGraphicItem, QwtPlotSvgItem
Definition qwt_plot_item.h:126
RenderHint
Render hints
Definition qwt_plot_item.h:225
ItemAttribute
Plot Item Attributes
Definition qwt_plot_item.h:172
QwtPlotItem(const QString &title)
Constructor with title as QString
ItemInterest
Plot Item Interests
Definition qwt_plot_item.h:202
A 2-D plotting widget
Definition qwt_plot.h:99
A class representing a scale division
Definition qwt_scale_div.h:47
A scale map
Definition qwt_scale_map.h:44
A class representing a text
Definition qwt_text.h:70