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
66class QWT_EXPORT QwtPlotItem
67{
68 public:
137
148 {
150 Legend = 0x01,
151
157 AutoScale = 0x02,
158
164 Margins = 0x04
165 };
166
167 Q_DECLARE_FLAGS( ItemAttributes, ItemAttribute )
168
169
180 {
185 ScaleInterest = 0x01,
186
197 LegendInterest = 0x02
198 };
199
200 Q_DECLARE_FLAGS( ItemInterests, ItemInterest )
201
202
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
A paint device for scalable graphics.
Definition qwt_graphic.h:76
Attributes of an entry on a legend.
A 2-D plotting widget.
Definition qwt_plot.h:79
Base class for items on the plot canvas.
QFlags< ItemInterest > ItemInterests
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item.
QFlags< RenderHint > RenderHints
QFlags< ItemAttribute > ItemAttributes
RttiValues
Runtime type information.
@ Rtti_PlotVectorField
For QwtPlotVectorField.
@ Rtti_PlotLegend
For QwtPlotLegendItem.
@ Rtti_PlotMarker
For QwtPlotMarker.
@ Rtti_PlotSpectroCurve
For QwtPlotSpectroCurve.
@ Rtti_PlotScale
For QwtPlotScaleItem.
@ Rtti_PlotHistogram
For QwtPlotHistogram.
@ Rtti_PlotZone
For QwtPlotZoneItem.
@ Rtti_PlotIntervalCurve
For QwtPlotIntervalCurve.
@ Rtti_PlotMultiBarChart
For QwtPlotMultiBarChart.
@ Rtti_PlotBarChart
For QwtPlotBarChart.
@ Rtti_PlotTradingCurve
For QwtPlotTradingCurve.
@ Rtti_PlotSpectrogram
For QwtPlotSpectrogram.
@ Rtti_PlotTextLabel
For QwtPlotTextLabel.
@ Rtti_PlotShape
For QwtPlotShapeItem.
@ Rtti_PlotGrid
For QwtPlotGrid.
@ Rtti_PlotCurve
For QwtPlotCurve.
@ Rtti_PlotGraphic
For QwtPlotGraphicItem, QwtPlotSvgItem.
RenderHint
Render hints.
ItemAttribute
Plot Item Attributes.
ItemInterest
Plot Item Interests.
A class representing a scale division.
A scale map.
A class representing a text.
Definition qwt_text.h:52