##// END OF EJS Templates
Fix Chart build when QT_NO_RUBBERBAND is defined...
Titta Heikkala -
r2623:e4fe606cdd4c
parent child
Show More
@@ -1,298 +1,317
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2013 Digia Plc
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include "qchartview.h"
21 #include "qchartview.h"
22 #include "qchartview_p.h"
22 #include "qchartview_p.h"
23 #include "qchart_p.h"
23 #include "qchart_p.h"
24 #include <QGraphicsScene>
24 #include <QGraphicsScene>
25 #include <QRubberBand>
25 #include <QRubberBand>
26
26
27 /*!
27 /*!
28 \enum QChartView::RubberBand
28 \enum QChartView::RubberBand
29
29
30 This enum describes the different types of rubber bands that can be used for zoom rect selection
30 This enum describes the different types of rubber bands that can be used for zoom rect selection
31
31
32 \value NoRubberBand
32 \value NoRubberBand
33 \value VerticalRubberBand
33 \value VerticalRubberBand
34 \value HorizonalRubberBand
34 \value HorizonalRubberBand
35 \value RectangleRubberBand
35 \value RectangleRubberBand
36 */
36 */
37
37
38 /*!
38 /*!
39 \class QChartView
39 \class QChartView
40 \brief Standalone charting widget.
40 \brief Standalone charting widget.
41
41
42 QChartView is a standalone widget that can display charts. It does not require separate
42 QChartView is a standalone widget that can display charts. It does not require separate
43 QGraphicsScene to work. If you want to display a chart in your existing QGraphicsScene,
43 QGraphicsScene to work. If you want to display a chart in your existing QGraphicsScene,
44 you need to use the QChart (or QPolarChart) class instead.
44 you need to use the QChart (or QPolarChart) class instead.
45
45
46 \sa QChart, QPolarChart
46 \sa QChart, QPolarChart
47 */
47 */
48
48
49 QTCOMMERCIALCHART_BEGIN_NAMESPACE
49 QTCOMMERCIALCHART_BEGIN_NAMESPACE
50
50
51 /*!
51 /*!
52 Constructs a chartView object with parent \a parent.
52 Constructs a chartView object with parent \a parent.
53 */
53 */
54
54
55 QChartView::QChartView(QWidget *parent)
55 QChartView::QChartView(QWidget *parent)
56 : QGraphicsView(parent),
56 : QGraphicsView(parent),
57 d_ptr(new QChartViewPrivate(this))
57 d_ptr(new QChartViewPrivate(this))
58 {
58 {
59
59
60 }
60 }
61
61
62 /*!
62 /*!
63 Constructs a chartview object with parent \a parent to display a \a chart.
63 Constructs a chartview object with parent \a parent to display a \a chart.
64 Ownership of the \a chart is passed to chartview.
64 Ownership of the \a chart is passed to chartview.
65 */
65 */
66
66
67 QChartView::QChartView(QChart *chart, QWidget *parent)
67 QChartView::QChartView(QChart *chart, QWidget *parent)
68 : QGraphicsView(parent),
68 : QGraphicsView(parent),
69 d_ptr(new QChartViewPrivate(this, chart))
69 d_ptr(new QChartViewPrivate(this, chart))
70 {
70 {
71
71
72 }
72 }
73
73
74
74
75 /*!
75 /*!
76 Destroys the chartview object and the associated chart.
76 Destroys the chartview object and the associated chart.
77 */
77 */
78 QChartView::~QChartView()
78 QChartView::~QChartView()
79 {
79 {
80 }
80 }
81
81
82 /*!
82 /*!
83 Returns the pointer to the associated chart.
83 Returns the pointer to the associated chart.
84 */
84 */
85 QChart *QChartView::chart() const
85 QChart *QChartView::chart() const
86 {
86 {
87 return d_ptr->m_chart;
87 return d_ptr->m_chart;
88 }
88 }
89
89
90 /*!
90 /*!
91 Sets the current chart to \a chart. Ownership of the new chart is passed to chartview
91 Sets the current chart to \a chart. Ownership of the new chart is passed to chartview
92 and ownership of the previous chart is released.
92 and ownership of the previous chart is released.
93
93
94 To avoid memory leaks users need to make sure the previous chart is deleted.
94 To avoid memory leaks users need to make sure the previous chart is deleted.
95 */
95 */
96
96
97 void QChartView::setChart(QChart *chart)
97 void QChartView::setChart(QChart *chart)
98 {
98 {
99 d_ptr->setChart(chart);
99 d_ptr->setChart(chart);
100 }
100 }
101
101
102 /*!
102 /*!
103 Sets the rubber band flags to \a rubberBand.
103 Sets the rubber band flags to \a rubberBand.
104 Selected flags determine the way zooming is performed.
104 Selected flags determine the way zooming is performed.
105
105
106 \note Rubber band zooming is not supported for polar charts.
106 \note Rubber band zooming is not supported for polar charts.
107 */
107 */
108 void QChartView::setRubberBand(const RubberBands &rubberBand)
108 void QChartView::setRubberBand(const RubberBands &rubberBand)
109 {
109 {
110 #ifndef QT_NO_RUBBERBAND
110 d_ptr->m_rubberBandFlags = rubberBand;
111 d_ptr->m_rubberBandFlags = rubberBand;
111
112
112 if (!d_ptr->m_rubberBandFlags) {
113 if (!d_ptr->m_rubberBandFlags) {
113 delete d_ptr->m_rubberBand;
114 delete d_ptr->m_rubberBand;
114 d_ptr->m_rubberBand = 0;
115 d_ptr->m_rubberBand = 0;
115 return;
116 return;
116 }
117 }
117
118
118 if (!d_ptr->m_rubberBand) {
119 if (!d_ptr->m_rubberBand) {
119 d_ptr->m_rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
120 d_ptr->m_rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
120 d_ptr->m_rubberBand->setEnabled(true);
121 d_ptr->m_rubberBand->setEnabled(true);
121 }
122 }
123 #else
124 Q_UNUSED(rubberBand);
125 qWarning("Unable to set rubber band because Qt is configured without it.");
126 #endif
122 }
127 }
123
128
124 /*!
129 /*!
125 Returns the rubber band flags that are currently being used by the widget.
130 Returns the rubber band flags that are currently being used by the widget.
126 */
131 */
127 QChartView::RubberBands QChartView::rubberBand() const
132 QChartView::RubberBands QChartView::rubberBand() const
128 {
133 {
129 return d_ptr->m_rubberBandFlags;
134 return d_ptr->m_rubberBandFlags;
130 }
135 }
131
136
132 /*!
137 /*!
133 If Left mouse button is pressed and the rubber band is enabled the \a event is accepted and the rubber band is displayed on the screen allowing the user to select the zoom area.
138 If Left mouse button is pressed and the rubber band is enabled the \a event is accepted and the rubber band is displayed on the screen allowing the user to select the zoom area.
134 If different mouse button is pressed and/or the rubber band is disabled then the \a event is passed to QGraphicsView::mousePressEvent() implementation.
139 If different mouse button is pressed and/or the rubber band is disabled then the \a event is passed to QGraphicsView::mousePressEvent() implementation.
135 */
140 */
136 void QChartView::mousePressEvent(QMouseEvent *event)
141 void QChartView::mousePressEvent(QMouseEvent *event)
137 {
142 {
143 #ifndef QT_NO_RUBBERBAND
138 QRectF plotArea = d_ptr->m_chart->plotArea();
144 QRectF plotArea = d_ptr->m_chart->plotArea();
139 if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isEnabled()
145 if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isEnabled()
140 && event->button() == Qt::LeftButton && plotArea.contains(event->pos())) {
146 && event->button() == Qt::LeftButton && plotArea.contains(event->pos())) {
141 d_ptr->m_rubberBandOrigin = event->pos();
147 d_ptr->m_rubberBandOrigin = event->pos();
142 d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin, QSize()));
148 d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin, QSize()));
143 d_ptr->m_rubberBand->show();
149 d_ptr->m_rubberBand->show();
144 event->accept();
150 event->accept();
145 } else {
151 } else {
152 #endif
146 QGraphicsView::mousePressEvent(event);
153 QGraphicsView::mousePressEvent(event);
154 #ifndef QT_NO_RUBBERBAND
147 }
155 }
156 #endif
148 }
157 }
149
158
150 /*!
159 /*!
151 If the rubber band rectange has been displayed in pressEvent then \a event data is used to update the rubber band geometry.
160 If the rubber band rectange has been displayed in pressEvent then \a event data is used to update the rubber band geometry.
152 Otherwise the default QGraphicsView::mouseMoveEvent implementation is called.
161 Otherwise the default QGraphicsView::mouseMoveEvent implementation is called.
153 */
162 */
154 void QChartView::mouseMoveEvent(QMouseEvent *event)
163 void QChartView::mouseMoveEvent(QMouseEvent *event)
155 {
164 {
165 #ifndef QT_NO_RUBBERBAND
156 if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
166 if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
157 QRect rect = d_ptr->m_chart->plotArea().toRect();
167 QRect rect = d_ptr->m_chart->plotArea().toRect();
158 int width = event->pos().x() - d_ptr->m_rubberBandOrigin.x();
168 int width = event->pos().x() - d_ptr->m_rubberBandOrigin.x();
159 int height = event->pos().y() - d_ptr->m_rubberBandOrigin.y();
169 int height = event->pos().y() - d_ptr->m_rubberBandOrigin.y();
160 if (!d_ptr->m_rubberBandFlags.testFlag(VerticalRubberBand)) {
170 if (!d_ptr->m_rubberBandFlags.testFlag(VerticalRubberBand)) {
161 d_ptr->m_rubberBandOrigin.setY(rect.top());
171 d_ptr->m_rubberBandOrigin.setY(rect.top());
162 height = rect.height();
172 height = rect.height();
163 }
173 }
164 if (!d_ptr->m_rubberBandFlags.testFlag(HorizonalRubberBand)) {
174 if (!d_ptr->m_rubberBandFlags.testFlag(HorizonalRubberBand)) {
165 d_ptr->m_rubberBandOrigin.setX(rect.left());
175 d_ptr->m_rubberBandOrigin.setX(rect.left());
166 width = rect.width();
176 width = rect.width();
167 }
177 }
168 d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin.x(), d_ptr->m_rubberBandOrigin.y(), width, height).normalized());
178 d_ptr->m_rubberBand->setGeometry(QRect(d_ptr->m_rubberBandOrigin.x(), d_ptr->m_rubberBandOrigin.y(), width, height).normalized());
169 } else {
179 } else {
180 #endif
170 QGraphicsView::mouseMoveEvent(event);
181 QGraphicsView::mouseMoveEvent(event);
182 #ifndef QT_NO_RUBBERBAND
171 }
183 }
184 #endif
172 }
185 }
173
186
174 /*!
187 /*!
175 If left mouse button is released and the rubber band is enabled then \a event is accepted and
188 If left mouse button is released and the rubber band is enabled then \a event is accepted and
176 the view is zoomed into the rect specified by the rubber band.
189 the view is zoomed into the rect specified by the rubber band.
177 If it is a right mouse button \a event then the view is zoomed out.
190 If it is a right mouse button \a event then the view is zoomed out.
178 */
191 */
179 void QChartView::mouseReleaseEvent(QMouseEvent *event)
192 void QChartView::mouseReleaseEvent(QMouseEvent *event)
180 {
193 {
194 #ifndef QT_NO_RUBBERBAND
181 if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
195 if (d_ptr->m_rubberBand && d_ptr->m_rubberBand->isVisible()) {
182 if (event->button() == Qt::LeftButton) {
196 if (event->button() == Qt::LeftButton) {
183 d_ptr->m_rubberBand->hide();
197 d_ptr->m_rubberBand->hide();
184 QRectF rect = d_ptr->m_rubberBand->geometry();
198 QRectF rect = d_ptr->m_rubberBand->geometry();
185 // Since plotArea uses QRectF and rubberband uses QRect, we can't just blindly use
199 // Since plotArea uses QRectF and rubberband uses QRect, we can't just blindly use
186 // rubberband's dimensions for vertical and horizontal rubberbands, where one
200 // rubberband's dimensions for vertical and horizontal rubberbands, where one
187 // dimension must match the corresponding plotArea dimension exactly.
201 // dimension must match the corresponding plotArea dimension exactly.
188 if (d_ptr->m_rubberBandFlags == VerticalRubberBand) {
202 if (d_ptr->m_rubberBandFlags == VerticalRubberBand) {
189 rect.setX(d_ptr->m_chart->plotArea().x());
203 rect.setX(d_ptr->m_chart->plotArea().x());
190 rect.setWidth(d_ptr->m_chart->plotArea().width());
204 rect.setWidth(d_ptr->m_chart->plotArea().width());
191 } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
205 } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
192 rect.setY(d_ptr->m_chart->plotArea().y());
206 rect.setY(d_ptr->m_chart->plotArea().y());
193 rect.setHeight(d_ptr->m_chart->plotArea().height());
207 rect.setHeight(d_ptr->m_chart->plotArea().height());
194 }
208 }
195 d_ptr->m_chart->zoomIn(rect);
209 d_ptr->m_chart->zoomIn(rect);
196 event->accept();
210 event->accept();
197 }
211 }
198
212
199 if (event->button() == Qt::RightButton) {
213 if (event->button() == Qt::RightButton) {
200 // If vertical or horizontal rubberband mode, restrict zoom out to specified axis.
214 // If vertical or horizontal rubberband mode, restrict zoom out to specified axis.
201 // Since there is no suitable API for that, use zoomIn with rect bigger than the
215 // Since there is no suitable API for that, use zoomIn with rect bigger than the
202 // plot area.
216 // plot area.
203 if (d_ptr->m_rubberBandFlags == VerticalRubberBand
217 if (d_ptr->m_rubberBandFlags == VerticalRubberBand
204 || d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
218 || d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
205 QRectF rect = d_ptr->m_chart->plotArea();
219 QRectF rect = d_ptr->m_chart->plotArea();
206 if (d_ptr->m_rubberBandFlags == VerticalRubberBand) {
220 if (d_ptr->m_rubberBandFlags == VerticalRubberBand) {
207 qreal adjustment = rect.height() / 2;
221 qreal adjustment = rect.height() / 2;
208 rect.adjust(0, -adjustment, 0, adjustment);
222 rect.adjust(0, -adjustment, 0, adjustment);
209 } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
223 } else if (d_ptr->m_rubberBandFlags == HorizonalRubberBand) {
210 qreal adjustment = rect.width() / 2;
224 qreal adjustment = rect.width() / 2;
211 rect.adjust(-adjustment, 0, adjustment, 0);
225 rect.adjust(-adjustment, 0, adjustment, 0);
212 }
226 }
213 d_ptr->m_chart->zoomIn(rect);
227 d_ptr->m_chart->zoomIn(rect);
214 } else {
228 } else {
215 d_ptr->m_chart->zoomOut();
229 d_ptr->m_chart->zoomOut();
216 }
230 }
217 event->accept();
231 event->accept();
218 }
232 }
219 } else {
233 } else {
234 #endif
220 QGraphicsView::mouseReleaseEvent(event);
235 QGraphicsView::mouseReleaseEvent(event);
236 #ifndef QT_NO_RUBBERBAND
221 }
237 }
238 #endif
222 }
239 }
223
240
224 /*!
241 /*!
225 Resizes and updates the chart area using the \a event data
242 Resizes and updates the chart area using the \a event data
226 */
243 */
227 void QChartView::resizeEvent(QResizeEvent *event)
244 void QChartView::resizeEvent(QResizeEvent *event)
228 {
245 {
229 QGraphicsView::resizeEvent(event);
246 QGraphicsView::resizeEvent(event);
230 d_ptr->resize();
247 d_ptr->resize();
231 }
248 }
232
249
233 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
250 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
234
251
235 QChartViewPrivate::QChartViewPrivate(QChartView *q, QChart *chart)
252 QChartViewPrivate::QChartViewPrivate(QChartView *q, QChart *chart)
236 : q_ptr(q),
253 : q_ptr(q),
237 m_scene(new QGraphicsScene(q)),
254 m_scene(new QGraphicsScene(q)),
238 m_chart(chart),
255 m_chart(chart),
256 #ifndef QT_NO_RUBBERBAND
239 m_rubberBand(0),
257 m_rubberBand(0),
258 #endif
240 m_rubberBandFlags(QChartView::NoRubberBand)
259 m_rubberBandFlags(QChartView::NoRubberBand)
241 {
260 {
242 q_ptr->setFrameShape(QFrame::NoFrame);
261 q_ptr->setFrameShape(QFrame::NoFrame);
243 q_ptr->setBackgroundRole(QPalette::Window);
262 q_ptr->setBackgroundRole(QPalette::Window);
244 q_ptr->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
263 q_ptr->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
245 q_ptr->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
264 q_ptr->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
246 q_ptr->setScene(m_scene);
265 q_ptr->setScene(m_scene);
247 q_ptr->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
266 q_ptr->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
248 if (!m_chart)
267 if (!m_chart)
249 m_chart = new QChart();
268 m_chart = new QChart();
250 m_scene->addItem(m_chart);
269 m_scene->addItem(m_chart);
251 }
270 }
252
271
253 QChartViewPrivate::~QChartViewPrivate()
272 QChartViewPrivate::~QChartViewPrivate()
254 {
273 {
255 }
274 }
256
275
257 void QChartViewPrivate::setChart(QChart *chart)
276 void QChartViewPrivate::setChart(QChart *chart)
258 {
277 {
259 Q_ASSERT(chart);
278 Q_ASSERT(chart);
260
279
261 if (m_chart == chart)
280 if (m_chart == chart)
262 return;
281 return;
263
282
264 if (m_chart)
283 if (m_chart)
265 m_scene->removeItem(m_chart);
284 m_scene->removeItem(m_chart);
266
285
267 m_chart = chart;
286 m_chart = chart;
268 m_scene->addItem(m_chart);
287 m_scene->addItem(m_chart);
269
288
270 resize();
289 resize();
271 }
290 }
272
291
273 void QChartViewPrivate::resize()
292 void QChartViewPrivate::resize()
274 {
293 {
275 // Fit the chart into view if it has been rotated
294 // Fit the chart into view if it has been rotated
276 qreal sinA = qAbs(q_ptr->transform().m21());
295 qreal sinA = qAbs(q_ptr->transform().m21());
277 qreal cosA = qAbs(q_ptr->transform().m11());
296 qreal cosA = qAbs(q_ptr->transform().m11());
278 QSize chartSize = q_ptr->size();
297 QSize chartSize = q_ptr->size();
279
298
280 if (sinA == 1.0) {
299 if (sinA == 1.0) {
281 chartSize.setHeight(q_ptr->size().width());
300 chartSize.setHeight(q_ptr->size().width());
282 chartSize.setWidth(q_ptr->size().height());
301 chartSize.setWidth(q_ptr->size().height());
283 } else if (sinA != 0.0) {
302 } else if (sinA != 0.0) {
284 // Non-90 degree rotation, find largest square chart that can fit into the view.
303 // Non-90 degree rotation, find largest square chart that can fit into the view.
285 qreal minDimension = qMin(q_ptr->size().width(), q_ptr->size().height());
304 qreal minDimension = qMin(q_ptr->size().width(), q_ptr->size().height());
286 qreal h = (minDimension - (minDimension / ((sinA / cosA) + 1.0))) / sinA;
305 qreal h = (minDimension - (minDimension / ((sinA / cosA) + 1.0))) / sinA;
287 chartSize.setHeight(h);
306 chartSize.setHeight(h);
288 chartSize.setWidth(h);
307 chartSize.setWidth(h);
289 }
308 }
290
309
291 m_chart->resize(chartSize);
310 m_chart->resize(chartSize);
292 q_ptr->setMinimumSize(m_chart->minimumSize().toSize());
311 q_ptr->setMinimumSize(m_chart->minimumSize().toSize());
293 q_ptr->setSceneRect(m_chart->geometry());
312 q_ptr->setSceneRect(m_chart->geometry());
294 }
313 }
295
314
296 #include "moc_qchartview.cpp"
315 #include "moc_qchartview.cpp"
297
316
298 QTCOMMERCIALCHART_END_NAMESPACE
317 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,63 +1,65
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2013 Digia Plc
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 // W A R N I N G
21 // W A R N I N G
22 // -------------
22 // -------------
23 //
23 //
24 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
24 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
25 // implementation detail. This header file may change from version to
25 // implementation detail. This header file may change from version to
26 // version without notice, or even be removed.
26 // version without notice, or even be removed.
27 //
27 //
28 // We mean it.
28 // We mean it.
29
29
30 #ifndef QCHARTVIEW_P_H
30 #ifndef QCHARTVIEW_P_H
31 #define QCHARTVIEW_P_H
31 #define QCHARTVIEW_P_H
32
32
33 #include "qchartview.h"
33 #include "qchartview.h"
34
34
35 class QGraphicsScene;
35 class QGraphicsScene;
36 class ChartPresenter;
36 class ChartPresenter;
37
37
38 QTCOMMERCIALCHART_BEGIN_NAMESPACE
38 QTCOMMERCIALCHART_BEGIN_NAMESPACE
39
39
40 class QChart;
40 class QChart;
41 class QChartView;
41 class QChartView;
42
42
43 class QChartViewPrivate
43 class QChartViewPrivate
44 {
44 {
45 public:
45 public:
46 explicit QChartViewPrivate(QChartView *q, QChart *chart = 0);
46 explicit QChartViewPrivate(QChartView *q, QChart *chart = 0);
47 ~QChartViewPrivate();
47 ~QChartViewPrivate();
48 void setChart(QChart *chart);
48 void setChart(QChart *chart);
49 void resize();
49 void resize();
50
50
51 protected:
51 protected:
52 QChartView *q_ptr;
52 QChartView *q_ptr;
53
53
54 public:
54 public:
55 QGraphicsScene *m_scene;
55 QGraphicsScene *m_scene;
56 QChart *m_chart;
56 QChart *m_chart;
57 QPoint m_rubberBandOrigin;
57 QPoint m_rubberBandOrigin;
58 #ifndef QT_NO_RUBBERBAND
58 QRubberBand *m_rubberBand;
59 QRubberBand *m_rubberBand;
60 #endif
59 QChartView::RubberBands m_rubberBandFlags;
61 QChartView::RubberBands m_rubberBandFlags;
60 };
62 };
61
63
62 QTCOMMERCIALCHART_END_NAMESPACE
64 QTCOMMERCIALCHART_END_NAMESPACE
63 #endif
65 #endif
General Comments 0
You need to be logged in to leave comments. Login now