Qwt User's Guide: qwt_plot_item.h Source File

Qwt User's Guide 5.2.3

- Main Page
- Related Pages
- Classes

qwt_plot_item.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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_legend_itemmanager.h"
15 #include "qwt_text.h"
16 #include "qwt_double_rect.h"
17
18 class QString;
19 class QRect;
20 class QPainter;
21 class QWidget;
22 class QwtPlot;
23 class QwtLegend;
24 class QwtScaleMap;
25 class QwtScaleDiv;
26
65 class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager
66 {
67 public:
74 enum RttiValues
75 {
76 Rtti_PlotItem = 0,
77
78 Rtti_PlotGrid,
79 Rtti_PlotScale,
80 Rtti_PlotMarker,
81 Rtti_PlotCurve,
82 Rtti_PlotHistogram,
83 Rtti_PlotSpectrogram,
84 Rtti_PlotSVG,
85
86 Rtti_PlotUserItem = 1000
87 };
88
100 enum ItemAttribute
101 {
102 Legend = 1,
103 AutoScale = 2
104 };
105
106 #if QT_VERSION >= 0x040000
107
108 enum RenderHint
109 {
110 RenderAntialiased = 1
111 };
112 #endif
113
114 explicit QwtPlotItem(const QwtText &title = QwtText());
115 virtual ~QwtPlotItem();
116
117 void attach(QwtPlot *plot);
118
126 void detach() { attach(NULL); }
127
128 QwtPlot *plot() const;
129
130 void setTitle(const QString &title);
131 void setTitle(const QwtText &title);
132 const QwtText &title() const;
133
134 virtual int rtti() const;
135
136 void setItemAttribute(ItemAttribute, bool on = true);
137 bool testItemAttribute(ItemAttribute) const;
138
139 #if QT_VERSION >= 0x040000
140 void setRenderHint(RenderHint, bool on = true);
141 bool testRenderHint(RenderHint) const;
142 #endif
143
144 double z() const;
145 void setZ(double z);
146
147 void show();
148 void hide();
149 virtual void setVisible(bool);
150 bool isVisible () const;
151
152 void setAxis(int xAxis, int yAxis);
153
154 void setXAxis(int axis);
155 int xAxis() const;
156
157 void setYAxis(int axis);
158 int yAxis() const;
159
160 virtual void itemChanged();
161
170 virtual void draw(QPainter *painter,
171 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
172 const QRect &canvasRect) const = 0;
173
174 virtual QwtDoubleRect boundingRect() const;
175
176 virtual void updateLegend(QwtLegend *) const;
177 virtual void updateScaleDiv(const QwtScaleDiv&,
178 const QwtScaleDiv&);
179
180 virtual QWidget *legendItem() const;
181
182 QwtDoubleRect scaleRect(const QwtScaleMap &, const QwtScaleMap &) const;
183 QRect paintRect(const QwtScaleMap &, const QwtScaleMap &) const;
184
185 QRect transform(const QwtScaleMap &, const QwtScaleMap &,
186 const QwtDoubleRect&) const;
187 QwtDoubleRect invTransform(const QwtScaleMap &, const QwtScaleMap &,
188 const QRect&) const;
189
190 private:
191 // Disabled copy constructor and operator=
192 QwtPlotItem( const QwtPlotItem & );
193 QwtPlotItem &operator=( const QwtPlotItem & );
194
195 class PrivateData;
196 PrivateData *d_data;
197 };
198
199 #endif