Qwt User's Guide: qwt_plot_item.h Source File

Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
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
10#ifndef QWT_PLOT_ITEM_H
11#define QWT_PLOT_ITEM_H
12
13#include "qwt_global.h"
14#include "qwt_axis_id.h"
15#include <qmetatype.h>
16
17class QwtScaleMap;
18class QwtScaleDiv;
19class QwtPlot;
20class QwtText;
21class QwtGraphic;
22class QwtLegendData;
23class QRectF;
24class QPainter;
25class QString;
26template< typename T > class QList;
27
66 class QWT_EXPORT QwtPlotItem
67{
68 public:
75 enum RttiValues
76 {
78 Rtti_PlotItem = 0,
79
81 Rtti_PlotGrid,
82
84 Rtti_PlotScale,
85
87 Rtti_PlotLegend,
88
90 Rtti_PlotMarker,
91
93 Rtti_PlotCurve,
94
96 Rtti_PlotSpectroCurve,
97
99 Rtti_PlotIntervalCurve,
100
102 Rtti_PlotHistogram,
103
105 Rtti_PlotSpectrogram,
106
108 Rtti_PlotGraphic,
109
111 Rtti_PlotTradingCurve,
112
114 Rtti_PlotBarChart,
115
117 Rtti_PlotMultiBarChart,
118
120 Rtti_PlotShape,
121
123 Rtti_PlotTextLabel,
124
126 Rtti_PlotZone,
127
129 Rtti_PlotVectorField,
130
135 Rtti_PlotUserItem = 1000
136 };
137
147 enum ItemAttribute
148 {
150 Legend = 0x01,
151
157 AutoScale = 0x02,
158
164 Margins = 0x04
165 };
166
167 Q_DECLARE_FLAGS( ItemAttributes, ItemAttribute )
168
169
179 enum ItemInterest
180 {
185 ScaleInterest = 0x01,
186
197 LegendInterest = 0x02
198 };
199
200 Q_DECLARE_FLAGS( ItemInterests, ItemInterest )
201
202
203 enum RenderHint
204 {
206 RenderAntialiased = 0x1
207 };
208
209 Q_DECLARE_FLAGS( RenderHints, RenderHint )
210
211 explicit QwtPlotItem();
212 explicit QwtPlotItem( const QString& title );
213 explicit QwtPlotItem( const QwtText& title );
214
215 virtual ~QwtPlotItem();
216
217 void attach( QwtPlot* plot );
218 void detach();
219
220 QwtPlot* plot() const;
221
222 void setTitle( const QString& title );
223 void setTitle( const QwtText& title );
224 const QwtText& title() const;
225
226 virtual int rtti() const;
227
228 void setItemAttribute( ItemAttribute, bool on = true );
229 bool testItemAttribute( ItemAttribute ) const;
230
231 void setItemInterest( ItemInterest, bool on = true );
232 bool testItemInterest( ItemInterest ) const;
233
234 void setRenderHint( RenderHint, bool on = true );
235 bool testRenderHint( RenderHint ) const;
236
237 void setRenderThreadCount( uint numThreads );
238 uint renderThreadCount() const;
239
240 void setLegendIconSize( const QSize& );
241 QSize legendIconSize() const;
242
243 double z() const;
244 void setZ( double z );
245
246 void show();
247 void hide();
248 virtual void setVisible( bool );
249 bool isVisible () const;
250
251 void setAxes( QwtAxisId xAxis, QwtAxisId yAxis );
252
253 void setXAxis( QwtAxisId );
254 QwtAxisId xAxis() const;
255
256 void setYAxis( QwtAxisId );
257 QwtAxisId yAxis() const;
258
259 virtual void itemChanged();
260 virtual void legendChanged();
261
270 virtual void draw( QPainter* painter,
271 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
272 const QRectF& canvasRect ) const = 0;
273
274 virtual QRectF boundingRect() const;
275
276 virtual void getCanvasMarginHint(
277 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
278 const QRectF& canvasRect,
279 double& left, double& top, double& right, double& bottom) const;
280
281 virtual void updateScaleDiv(
282 const QwtScaleDiv&, const QwtScaleDiv& );
283
284 virtual void updateLegend( const QwtPlotItem*,
285 const QList< QwtLegendData >& );
286
287 QRectF scaleRect( const QwtScaleMap&, const QwtScaleMap& ) const;
288 QRectF paintRect( const QwtScaleMap&, const QwtScaleMap& ) const;
289
290 virtual QList< QwtLegendData > legendData() const;
291
292 virtual QwtGraphic legendIcon( int index, const QSizeF& ) const;
293
294 protected:
295 QwtGraphic defaultIcon( const QBrush&, const QSizeF& ) const;
296
297 private:
298 Q_DISABLE_COPY(QwtPlotItem)
299
300 class PrivateData;
301 PrivateData* m_data;
302};
303
304Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemAttributes )
305Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemInterests )
306Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::RenderHints )
307
308Q_DECLARE_METATYPE( QwtPlotItem* )
309
310#endif
QList
Definition qwt_abstract_legend.h:17
QwtGraphic
A paint device for scalable graphics.
Definition qwt_graphic.h:76
QwtLegendData
Attributes of an entry on a legend.
Definition qwt_legend_data.h:37
QwtPlot
A 2-D plotting widget.
Definition qwt_plot.h:79
QwtPlotItem
Base class for items on the plot canvas.
Definition qwt_plot_item.h:67
QwtPlotItem::ItemInterests
QFlags< ItemInterest > ItemInterests
Definition qwt_plot_item.h:200
QwtPlotItem::draw
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item.
QwtPlotItem::RenderHints
QFlags< RenderHint > RenderHints
Definition qwt_plot_item.h:209
QwtPlotItem::ItemAttributes
QFlags< ItemAttribute > ItemAttributes
Definition qwt_plot_item.h:167
QwtPlotItem::RttiValues
RttiValues
Runtime type information.
Definition qwt_plot_item.h:76
QwtPlotItem::Rtti_PlotVectorField
@ Rtti_PlotVectorField
For QwtPlotVectorField.
Definition qwt_plot_item.h:129
QwtPlotItem::Rtti_PlotLegend
@ Rtti_PlotLegend
For QwtPlotLegendItem.
Definition qwt_plot_item.h:87
QwtPlotItem::Rtti_PlotMarker
@ Rtti_PlotMarker
For QwtPlotMarker.
Definition qwt_plot_item.h:90
QwtPlotItem::Rtti_PlotSpectroCurve
@ Rtti_PlotSpectroCurve
For QwtPlotSpectroCurve.
Definition qwt_plot_item.h:96
QwtPlotItem::Rtti_PlotScale
@ Rtti_PlotScale
For QwtPlotScaleItem.
Definition qwt_plot_item.h:84
QwtPlotItem::Rtti_PlotHistogram
@ Rtti_PlotHistogram
For QwtPlotHistogram.
Definition qwt_plot_item.h:102
QwtPlotItem::Rtti_PlotZone
@ Rtti_PlotZone
For QwtPlotZoneItem.
Definition qwt_plot_item.h:126
QwtPlotItem::Rtti_PlotIntervalCurve
@ Rtti_PlotIntervalCurve
For QwtPlotIntervalCurve.
Definition qwt_plot_item.h:99
QwtPlotItem::Rtti_PlotMultiBarChart
@ Rtti_PlotMultiBarChart
For QwtPlotMultiBarChart.
Definition qwt_plot_item.h:117
QwtPlotItem::Rtti_PlotBarChart
@ Rtti_PlotBarChart
For QwtPlotBarChart.
Definition qwt_plot_item.h:114
QwtPlotItem::Rtti_PlotTradingCurve
@ Rtti_PlotTradingCurve
For QwtPlotTradingCurve.
Definition qwt_plot_item.h:111
QwtPlotItem::Rtti_PlotSpectrogram
@ Rtti_PlotSpectrogram
For QwtPlotSpectrogram.
Definition qwt_plot_item.h:105
QwtPlotItem::Rtti_PlotTextLabel
@ Rtti_PlotTextLabel
For QwtPlotTextLabel.
Definition qwt_plot_item.h:123
QwtPlotItem::Rtti_PlotShape
@ Rtti_PlotShape
For QwtPlotShapeItem.
Definition qwt_plot_item.h:120
QwtPlotItem::Rtti_PlotGrid
@ Rtti_PlotGrid
For QwtPlotGrid.
Definition qwt_plot_item.h:81
QwtPlotItem::Rtti_PlotCurve
@ Rtti_PlotCurve
For QwtPlotCurve.
Definition qwt_plot_item.h:93
QwtPlotItem::Rtti_PlotGraphic
@ Rtti_PlotGraphic
For QwtPlotGraphicItem, QwtPlotSvgItem.
Definition qwt_plot_item.h:108
QwtPlotItem::RenderHint
RenderHint
Render hints.
Definition qwt_plot_item.h:204
QwtPlotItem::ItemAttribute
ItemAttribute
Plot Item Attributes.
Definition qwt_plot_item.h:148
QwtPlotItem::ItemInterest
ItemInterest
Plot Item Interests.
Definition qwt_plot_item.h:180
QwtScaleDiv
A class representing a scale division.
Definition qwt_scale_div.h:34
QwtScaleMap
A scale map.
Definition qwt_scale_map.h:27
QwtText
A class representing a text.
Definition qwt_text.h:52