##// END OF EJS Templates
commented out scroll implementations from QChart. Was calling ticksCount() which is now private
sauimone -
r1546:7a970647db42
parent child
Show More
@@ -1,469 +1,469
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 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 Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial 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 "qchart.h"
21 #include "qchart.h"
22 #include "qchart_p.h"
22 #include "qchart_p.h"
23 #include "legendscroller_p.h"
23 #include "legendscroller_p.h"
24 #include "qlegend_p.h"
24 #include "qlegend_p.h"
25 #include "chartbackground_p.h"
25 #include "chartbackground_p.h"
26 #include "qabstractaxis.h"
26 #include "qabstractaxis.h"
27 #include <QGraphicsScene>
27 #include <QGraphicsScene>
28 #include <QGraphicsSceneResizeEvent>
28 #include <QGraphicsSceneResizeEvent>
29 #include <QGraphicsLayout>
29 #include <QGraphicsLayout>
30
30
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32
32
33 /*!
33 /*!
34 \enum QChart::ChartTheme
34 \enum QChart::ChartTheme
35
35
36 This enum describes the theme used by the chart.
36 This enum describes the theme used by the chart.
37
37
38 \value ChartThemeLight The default theme
38 \value ChartThemeLight The default theme
39 \value ChartThemeBlueCerulean
39 \value ChartThemeBlueCerulean
40 \value ChartThemeDark
40 \value ChartThemeDark
41 \value ChartThemeBrownSand
41 \value ChartThemeBrownSand
42 \value ChartThemeBlueNcs
42 \value ChartThemeBlueNcs
43 \value ChartThemeHighContrast
43 \value ChartThemeHighContrast
44 \value ChartThemeBlueIcy
44 \value ChartThemeBlueIcy
45 */
45 */
46
46
47 /*!
47 /*!
48 \enum QChart::AnimationOption
48 \enum QChart::AnimationOption
49
49
50 For enabling/disabling animations. Defaults to NoAnimation.
50 For enabling/disabling animations. Defaults to NoAnimation.
51
51
52 \value NoAnimation
52 \value NoAnimation
53 \value GridAxisAnimations
53 \value GridAxisAnimations
54 \value SeriesAnimations
54 \value SeriesAnimations
55 \value AllAnimations
55 \value AllAnimations
56 */
56 */
57
57
58 /*!
58 /*!
59 \class QChart
59 \class QChart
60 \brief QtCommercial chart API.
60 \brief QtCommercial chart API.
61
61
62 QChart is a QGraphicsWidget that you can show in a QGraphicsScene. It manages the graphical
62 QChart is a QGraphicsWidget that you can show in a QGraphicsScene. It manages the graphical
63 representation of different types of series and other chart related objects like
63 representation of different types of series and other chart related objects like
64 QAxis and QLegend. If you simply want to show a chart in a layout, you can use the
64 QAxis and QLegend. If you simply want to show a chart in a layout, you can use the
65 convenience class QChartView instead of QChart.
65 convenience class QChartView instead of QChart.
66 \sa QChartView
66 \sa QChartView
67 */
67 */
68
68
69 /*!
69 /*!
70 \property QChart::animationOptions
70 \property QChart::animationOptions
71 The animation \a options for the chart. Animations are enabled/disabled based on this setting.
71 The animation \a options for the chart. Animations are enabled/disabled based on this setting.
72 */
72 */
73
73
74 /*!
74 /*!
75 \property QChart::backgroundVisible
75 \property QChart::backgroundVisible
76 Whether the chart background is visible or not.
76 Whether the chart background is visible or not.
77 \sa setBackgroundBrush(), setBackgroundPen()
77 \sa setBackgroundBrush(), setBackgroundPen()
78 */
78 */
79
79
80 /*!
80 /*!
81 \property QChart::dropShadowEnabled
81 \property QChart::dropShadowEnabled
82 If set to true, the background drop shadow effect is enabled. If set to false, it is disabled. Note that the drop
82 If set to true, the background drop shadow effect is enabled. If set to false, it is disabled. Note that the drop
83 shadow effect depends on theme, which means the setting may be changed if you switch to another theme.
83 shadow effect depends on theme, which means the setting may be changed if you switch to another theme.
84 */
84 */
85
85
86 /*!
86 /*!
87 \property QChart::margins
87 \property QChart::margins
88 Margins around the plot area. Note that the margin area is used for drawing chart title, legend and axes.
88 Margins around the plot area. Note that the margin area is used for drawing chart title, legend and axes.
89 */
89 */
90
90
91 /*!
91 /*!
92 \property QChart::theme
92 \property QChart::theme
93 Theme is a built-in collection of UI style related settings applied for all visual elements of a chart, like colors,
93 Theme is a built-in collection of UI style related settings applied for all visual elements of a chart, like colors,
94 pens, brushes and fonts of series, axes, title and legend. \l {Chart themes demo} shows an example with a few
94 pens, brushes and fonts of series, axes, title and legend. \l {Chart themes demo} shows an example with a few
95 different themes.
95 different themes.
96 Note: changing the theme will overwrite all customizations previously applied to the series.
96 Note: changing the theme will overwrite all customizations previously applied to the series.
97 */
97 */
98
98
99 /*!
99 /*!
100 \property QChart::title
100 \property QChart::title
101 Title is the name (label) of a chart. It is shown as a headline on top of the chart.
101 Title is the name (label) of a chart. It is shown as a headline on top of the chart.
102 */
102 */
103
103
104 /*!
104 /*!
105 \fn void QChart::marginsChanged(QRectF newMargins)
105 \fn void QChart::marginsChanged(QRectF newMargins)
106 The margins around plot area have changed to \a newMargins. This may happen for example if you change title font size,
106 The margins around plot area have changed to \a newMargins. This may happen for example if you change title font size,
107 modify axes or hide/show legend.
107 modify axes or hide/show legend.
108 */
108 */
109
109
110 /*!
110 /*!
111 Constructs a chart object which is a child of a\a parent. Parameter \a wFlags is passed to the QGraphicsWidget constructor.
111 Constructs a chart object which is a child of a\a parent. Parameter \a wFlags is passed to the QGraphicsWidget constructor.
112 */
112 */
113 QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) : QGraphicsWidget(parent,wFlags),
113 QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) : QGraphicsWidget(parent,wFlags),
114 d_ptr(new QChartPrivate())
114 d_ptr(new QChartPrivate())
115 {
115 {
116 d_ptr->m_dataset = new ChartDataSet(this);
116 d_ptr->m_dataset = new ChartDataSet(this);
117 d_ptr->m_presenter = new ChartPresenter(this,d_ptr->m_dataset);
117 d_ptr->m_presenter = new ChartPresenter(this,d_ptr->m_dataset);
118 d_ptr->createConnections();
118 d_ptr->createConnections();
119 d_ptr->m_legend = new LegendScroller(this);
119 d_ptr->m_legend = new LegendScroller(this);
120 d_ptr->m_presenter->setTheme(QChart::ChartThemeLight, false);
120 d_ptr->m_presenter->setTheme(QChart::ChartThemeLight, false);
121 //connect(d_ptr->m_presenter, SIGNAL(marginsChanged(QRectF)), this, SIGNAL(marginsChanged(QRectF)));
121 //connect(d_ptr->m_presenter, SIGNAL(marginsChanged(QRectF)), this, SIGNAL(marginsChanged(QRectF)));
122 setLayout(d_ptr->m_presenter->layout());
122 setLayout(d_ptr->m_presenter->layout());
123 }
123 }
124
124
125 /*!
125 /*!
126 Destroys the object and it's children, like series and axis objects added to it.
126 Destroys the object and it's children, like series and axis objects added to it.
127 */
127 */
128 QChart::~QChart()
128 QChart::~QChart()
129 {
129 {
130 //delete first presenter , since this is a root of all the graphical items
130 //delete first presenter , since this is a root of all the graphical items
131 setLayout(0);
131 setLayout(0);
132 delete d_ptr->m_presenter;
132 delete d_ptr->m_presenter;
133 d_ptr->m_presenter=0;
133 d_ptr->m_presenter=0;
134 }
134 }
135
135
136 /*!
136 /*!
137 Adds the \a series and optional \a axisY onto the chart and takes the ownership of the objects.
137 Adds the \a series and optional \a axisY onto the chart and takes the ownership of the objects.
138 If auto scaling is enabled, re-scales the axes the series is bound to (both the x axis and
138 If auto scaling is enabled, re-scales the axes the series is bound to (both the x axis and
139 the y axis).
139 the y axis).
140
140
141 \sa removeSeries(), removeAllSeries()
141 \sa removeSeries(), removeAllSeries()
142 */
142 */
143 void QChart::addSeries(QAbstractSeries *series)
143 void QChart::addSeries(QAbstractSeries *series)
144 {
144 {
145 Q_ASSERT(series);
145 Q_ASSERT(series);
146 d_ptr->m_dataset->addSeries(series);
146 d_ptr->m_dataset->addSeries(series);
147 }
147 }
148
148
149 /*!
149 /*!
150 Removes the \a series specified in a perameter from the QChartView.
150 Removes the \a series specified in a perameter from the QChartView.
151 It releses its ownership of the specified QChartSeries object.
151 It releses its ownership of the specified QChartSeries object.
152 It does not delete the pointed QChartSeries data object
152 It does not delete the pointed QChartSeries data object
153 \sa addSeries(), removeAllSeries()
153 \sa addSeries(), removeAllSeries()
154 */
154 */
155 void QChart::removeSeries(QAbstractSeries *series)
155 void QChart::removeSeries(QAbstractSeries *series)
156 {
156 {
157 Q_ASSERT(series);
157 Q_ASSERT(series);
158 d_ptr->m_dataset->removeSeries(series);
158 d_ptr->m_dataset->removeSeries(series);
159 }
159 }
160
160
161 /*!
161 /*!
162 Removes all the QChartSeries that have been added to the QChartView
162 Removes all the QChartSeries that have been added to the QChartView
163 It also deletes the pointed QChartSeries data objects
163 It also deletes the pointed QChartSeries data objects
164 \sa addSeries(), removeSeries()
164 \sa addSeries(), removeSeries()
165 */
165 */
166 void QChart::removeAllSeries()
166 void QChart::removeAllSeries()
167 {
167 {
168 d_ptr->m_dataset->removeAllSeries();
168 d_ptr->m_dataset->removeAllSeries();
169 }
169 }
170
170
171 /*!
171 /*!
172 Sets the \a brush that is used for painting the background of the chart area.
172 Sets the \a brush that is used for painting the background of the chart area.
173 */
173 */
174 void QChart::setBackgroundBrush(const QBrush& brush)
174 void QChart::setBackgroundBrush(const QBrush& brush)
175 {
175 {
176 d_ptr->m_presenter->setBackgroundBrush(brush);
176 d_ptr->m_presenter->setBackgroundBrush(brush);
177 }
177 }
178
178
179 /*!
179 /*!
180 Gets the brush that is used for painting the background of the chart area.
180 Gets the brush that is used for painting the background of the chart area.
181 */
181 */
182 QBrush QChart::backgroundBrush() const
182 QBrush QChart::backgroundBrush() const
183 {
183 {
184 return d_ptr->m_presenter->backgroundBrush();
184 return d_ptr->m_presenter->backgroundBrush();
185 }
185 }
186
186
187 /*!
187 /*!
188 Sets the \a pen that is used for painting the background of the chart area.
188 Sets the \a pen that is used for painting the background of the chart area.
189 */
189 */
190 void QChart::setBackgroundPen(const QPen& pen)
190 void QChart::setBackgroundPen(const QPen& pen)
191 {
191 {
192 d_ptr->m_presenter->setBackgroundPen(pen);
192 d_ptr->m_presenter->setBackgroundPen(pen);
193 }
193 }
194
194
195 /*!
195 /*!
196 Gets the pen that is used for painting the background of the chart area.
196 Gets the pen that is used for painting the background of the chart area.
197 */
197 */
198 QPen QChart::backgroundPen() const
198 QPen QChart::backgroundPen() const
199 {
199 {
200 return d_ptr->m_presenter->backgroundPen();
200 return d_ptr->m_presenter->backgroundPen();
201 }
201 }
202
202
203 /*!
203 /*!
204 Sets the chart \a title. The description text that is drawn above the chart.
204 Sets the chart \a title. The description text that is drawn above the chart.
205 */
205 */
206 void QChart::setTitle(const QString& title)
206 void QChart::setTitle(const QString& title)
207 {
207 {
208 d_ptr->m_presenter->setTitle(title);
208 d_ptr->m_presenter->setTitle(title);
209 }
209 }
210
210
211 /*!
211 /*!
212 Returns the chart title. The description text that is drawn above the chart.
212 Returns the chart title. The description text that is drawn above the chart.
213 */
213 */
214 QString QChart::title() const
214 QString QChart::title() const
215 {
215 {
216 return d_ptr->m_presenter->title();
216 return d_ptr->m_presenter->title();
217 }
217 }
218
218
219 /*!
219 /*!
220 Sets the \a font that is used for drawing the chart description text that is rendered above the chart.
220 Sets the \a font that is used for drawing the chart description text that is rendered above the chart.
221 */
221 */
222 void QChart::setTitleFont(const QFont& font)
222 void QChart::setTitleFont(const QFont& font)
223 {
223 {
224 d_ptr->m_presenter->setTitleFont(font);
224 d_ptr->m_presenter->setTitleFont(font);
225 }
225 }
226
226
227 /*!
227 /*!
228 Gets the font that is used for drawing the chart description text that is rendered above the chart.
228 Gets the font that is used for drawing the chart description text that is rendered above the chart.
229 */
229 */
230 QFont QChart::titleFont() const
230 QFont QChart::titleFont() const
231 {
231 {
232 return d_ptr->m_presenter->titleFont();
232 return d_ptr->m_presenter->titleFont();
233 }
233 }
234
234
235 /*!
235 /*!
236 Sets the \a brush used for rendering the title text.
236 Sets the \a brush used for rendering the title text.
237 */
237 */
238 void QChart::setTitleBrush(const QBrush &brush)
238 void QChart::setTitleBrush(const QBrush &brush)
239 {
239 {
240 d_ptr->m_presenter->setTitleBrush(brush);
240 d_ptr->m_presenter->setTitleBrush(brush);
241 }
241 }
242
242
243 /*!
243 /*!
244 Returns the brush used for rendering the title text.
244 Returns the brush used for rendering the title text.
245 */
245 */
246 QBrush QChart::titleBrush() const
246 QBrush QChart::titleBrush() const
247 {
247 {
248 return d_ptr->m_presenter->titleBrush();
248 return d_ptr->m_presenter->titleBrush();
249 }
249 }
250
250
251 void QChart::setTheme(QChart::ChartTheme theme)
251 void QChart::setTheme(QChart::ChartTheme theme)
252 {
252 {
253 d_ptr->m_presenter->setTheme(theme);
253 d_ptr->m_presenter->setTheme(theme);
254 }
254 }
255
255
256 QChart::ChartTheme QChart::theme() const
256 QChart::ChartTheme QChart::theme() const
257 {
257 {
258 return d_ptr->m_presenter->theme();
258 return d_ptr->m_presenter->theme();
259 }
259 }
260
260
261 /*!
261 /*!
262 Zooms in the view by a factor of 2
262 Zooms in the view by a factor of 2
263 */
263 */
264 void QChart::zoomIn()
264 void QChart::zoomIn()
265 {
265 {
266 d_ptr->m_presenter->zoomIn(2.0);
266 d_ptr->m_presenter->zoomIn(2.0);
267 }
267 }
268
268
269 /*!
269 /*!
270 Zooms in the view to a maximum level at which \a rect is still fully visible.
270 Zooms in the view to a maximum level at which \a rect is still fully visible.
271 */
271 */
272 void QChart::zoomIn(const QRectF& rect)
272 void QChart::zoomIn(const QRectF& rect)
273 {
273 {
274 if (!rect.isValid()) return;
274 if (!rect.isValid()) return;
275 d_ptr->m_presenter->zoomIn(rect);
275 d_ptr->m_presenter->zoomIn(rect);
276 }
276 }
277
277
278 /*!
278 /*!
279 Restores the view zoom level to the previous one.
279 Restores the view zoom level to the previous one.
280 */
280 */
281 void QChart::zoomOut()
281 void QChart::zoomOut()
282 {
282 {
283 d_ptr->m_presenter->zoomOut(2.0);
283 d_ptr->m_presenter->zoomOut(2.0);
284 }
284 }
285
285
286 /*!
286 /*!
287 Zooms in the view by a \a factor.
287 Zooms in the view by a \a factor.
288
288
289 A factor over 1.0 zooms the view in and factor between 0.0 and 1.0 zooms out.
289 A factor over 1.0 zooms the view in and factor between 0.0 and 1.0 zooms out.
290 */
290 */
291 void QChart::zoom(qreal factor)
291 void QChart::zoom(qreal factor)
292 {
292 {
293 if (qFuzzyIsNull(factor))
293 if (qFuzzyIsNull(factor))
294 return;
294 return;
295
295
296 if (qFuzzyCompare(factor, 1.0))
296 if (qFuzzyCompare(factor, 1.0))
297 return;
297 return;
298
298
299 if (factor < 0)
299 if (factor < 0)
300 return;
300 return;
301
301
302 if (factor > 1.0)
302 if (factor > 1.0)
303 d_ptr->m_presenter->zoomIn(factor);
303 d_ptr->m_presenter->zoomIn(factor);
304 else
304 else
305 d_ptr->m_presenter->zoomOut(1.0 / factor);
305 d_ptr->m_presenter->zoomOut(1.0 / factor);
306 }
306 }
307
307
308 /*!
308 /*!
309 Returns the pointer to the x axis object of the chart
309 Returns the pointer to the x axis object of the chart
310 */
310 */
311 QAbstractAxis* QChart::axisX(QAbstractSeries* series) const
311 QAbstractAxis* QChart::axisX(QAbstractSeries* series) const
312 {
312 {
313 return d_ptr->m_dataset->axisX(series);
313 return d_ptr->m_dataset->axisX(series);
314 }
314 }
315
315
316 /*!
316 /*!
317 Returns the pointer to the y axis object of the \a series
317 Returns the pointer to the y axis object of the \a series
318 If no \a series is provided then default Y axis of the chart is returned.
318 If no \a series is provided then default Y axis of the chart is returned.
319 */
319 */
320 QAbstractAxis* QChart::axisY(QAbstractSeries *series) const
320 QAbstractAxis* QChart::axisY(QAbstractSeries *series) const
321 {
321 {
322 return d_ptr->m_dataset->axisY(series);
322 return d_ptr->m_dataset->axisY(series);
323 }
323 }
324
324
325 /*!
325 /*!
326 Returns the legend object of the chart. Ownership stays in chart.
326 Returns the legend object of the chart. Ownership stays in chart.
327 */
327 */
328 QLegend* QChart::legend() const
328 QLegend* QChart::legend() const
329 {
329 {
330 return d_ptr->m_legend;
330 return d_ptr->m_legend;
331 }
331 }
332
332
333 /*!
333 /*!
334 Returns the rect that contains information about margins (distance between chart widget edge and axes).
334 Returns the rect that contains information about margins (distance between chart widget edge and axes).
335 Individual margins can be obtained by calling left, top, right, bottom on the returned rect.
335 Individual margins can be obtained by calling left, top, right, bottom on the returned rect.
336 */
336 */
337 QRectF QChart::margins() const
337 QRectF QChart::margins() const
338 {
338 {
339 return d_ptr->m_presenter->margins();
339 return d_ptr->m_presenter->margins();
340 }
340 }
341
341
342 /*!
342 /*!
343 Sets animation \a options for the chart
343 Sets animation \a options for the chart
344 */
344 */
345
345
346 void QChart::setAnimationOptions(AnimationOptions options)
346 void QChart::setAnimationOptions(AnimationOptions options)
347 {
347 {
348 d_ptr->m_presenter->setAnimationOptions(options);
348 d_ptr->m_presenter->setAnimationOptions(options);
349 }
349 }
350
350
351 QChart::AnimationOptions QChart::animationOptions() const
351 QChart::AnimationOptions QChart::animationOptions() const
352 {
352 {
353 return d_ptr->m_presenter->animationOptions();
353 return d_ptr->m_presenter->animationOptions();
354 }
354 }
355
355
356 /*!
356 /*!
357 Scrolls the visible area of the chart to the left by the distance between two x axis ticks
357 Scrolls the visible area of the chart to the left by the distance between two x axis ticks
358 */
358 */
359 void QChart::scrollLeft()
359 void QChart::scrollLeft()
360 {
360 {
361 d_ptr->m_presenter->scroll(-d_ptr->m_presenter->geometry().width()/(axisX()->ticksCount()-1),0);
361 // d_ptr->m_presenter->scroll(-d_ptr->m_presenter->geometry().width()/(axisX()->ticksCount()-1),0);
362 }
362 }
363
363
364 /*!
364 /*!
365 Scrolls the visible area of the chart to the right by the distance between two x axis ticks
365 Scrolls the visible area of the chart to the right by the distance between two x axis ticks
366 */
366 */
367 void QChart::scrollRight()
367 void QChart::scrollRight()
368 {
368 {
369 d_ptr->m_presenter->scroll(d_ptr->m_presenter->geometry().width()/(axisX()->ticksCount()-1),0);
369 // d_ptr->m_presenter->scroll(d_ptr->m_presenter->geometry().width()/(axisX()->ticksCount()-1),0);
370 }
370 }
371
371
372 /*!
372 /*!
373 Scrolls the visible area of the chart up by the distance between two y axis ticks
373 Scrolls the visible area of the chart up by the distance between two y axis ticks
374 */
374 */
375 void QChart::scrollUp()
375 void QChart::scrollUp()
376 {
376 {
377 d_ptr->m_presenter->scroll(0,d_ptr->m_presenter->geometry().width()/(axisY()->ticksCount()-1));
377 // d_ptr->m_presenter->scroll(0,d_ptr->m_presenter->geometry().width()/(axisY()->ticksCount()-1));
378 }
378 }
379
379
380 /*!
380 /*!
381 Scrolls the visible area of the chart down by the distance between two y axis ticks
381 Scrolls the visible area of the chart down by the distance between two y axis ticks
382 */
382 */
383 void QChart::scrollDown()
383 void QChart::scrollDown()
384 {
384 {
385 d_ptr->m_presenter->scroll(0,-d_ptr->m_presenter->geometry().width()/(axisY()->ticksCount()-1));
385 // d_ptr->m_presenter->scroll(0,-d_ptr->m_presenter->geometry().width()/(axisY()->ticksCount()-1));
386 }
386 }
387
387
388 /*!
388 /*!
389 Scrolls the visible area of the chart by the distance defined in the \a delta.
389 Scrolls the visible area of the chart by the distance defined in the \a delta.
390 */
390 */
391 void QChart::scroll(const QPointF &delta)
391 void QChart::scroll(const QPointF &delta)
392 {
392 {
393 d_ptr->m_presenter->scroll(-delta.x(), delta.y());
393 d_ptr->m_presenter->scroll(-delta.x(), delta.y());
394 }
394 }
395
395
396 void QChart::setBackgroundVisible(bool visible)
396 void QChart::setBackgroundVisible(bool visible)
397 {
397 {
398 d_ptr->m_presenter->setBackgroundVisible(visible);
398 d_ptr->m_presenter->setBackgroundVisible(visible);
399 }
399 }
400
400
401 bool QChart::isBackgroundVisible() const
401 bool QChart::isBackgroundVisible() const
402 {
402 {
403 return d_ptr->m_presenter->isBackgroundVisible();
403 return d_ptr->m_presenter->isBackgroundVisible();
404 }
404 }
405
405
406 void QChart::setDropShadowEnabled(bool enabled)
406 void QChart::setDropShadowEnabled(bool enabled)
407 {
407 {
408 d_ptr->m_presenter->setBackgroundDropShadowEnabled(enabled);
408 d_ptr->m_presenter->setBackgroundDropShadowEnabled(enabled);
409 }
409 }
410
410
411 bool QChart::isDropShadowEnabled() const
411 bool QChart::isDropShadowEnabled() const
412 {
412 {
413 return d_ptr->m_presenter->isBackgroundDropShadowEnabled();
413 return d_ptr->m_presenter->isBackgroundDropShadowEnabled();
414 }
414 }
415
415
416 /*!
416 /*!
417 Returns all the series that are added to the chart.
417 Returns all the series that are added to the chart.
418
418
419 \sa addSeries(), removeSeries(), removeAllSeries()
419 \sa addSeries(), removeSeries(), removeAllSeries()
420 */
420 */
421 QList<QAbstractSeries*> QChart::series() const
421 QList<QAbstractSeries*> QChart::series() const
422 {
422 {
423 return d_ptr->m_dataset->series();
423 return d_ptr->m_dataset->series();
424 }
424 }
425
425
426 void QChart::setMarginsMinimum(const QRectF& margins)
426 void QChart::setMarginsMinimum(const QRectF& margins)
427 {
427 {
428 d_ptr->m_presenter->setMarginsMinimum(margins);
428 d_ptr->m_presenter->setMarginsMinimum(margins);
429 }
429 }
430
430
431 void QChart::setAxisX(QAbstractSeries *series, QAbstractAxis* axis)
431 void QChart::setAxisX(QAbstractSeries *series, QAbstractAxis* axis)
432 {
432 {
433 Q_UNUSED(series);
433 Q_UNUSED(series);
434 Q_UNUSED(axis);
434 Q_UNUSED(axis);
435 }
435 }
436
436
437 void QChart::setAxisY(QAbstractSeries *series, QAbstractAxis* axis)
437 void QChart::setAxisY(QAbstractSeries *series, QAbstractAxis* axis)
438 {
438 {
439 Q_UNUSED(series);
439 Q_UNUSED(series);
440 Q_UNUSED(axis);
440 Q_UNUSED(axis);
441 }
441 }
442
442
443 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
443 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
444
444
445 QChartPrivate::QChartPrivate():
445 QChartPrivate::QChartPrivate():
446 m_legend(0),
446 m_legend(0),
447 m_dataset(0),
447 m_dataset(0),
448 m_presenter(0)
448 m_presenter(0)
449 {
449 {
450
450
451 }
451 }
452
452
453 QChartPrivate::~QChartPrivate()
453 QChartPrivate::~QChartPrivate()
454 {
454 {
455
455
456 }
456 }
457
457
458 void QChartPrivate::createConnections()
458 void QChartPrivate::createConnections()
459 {
459 {
460 QObject::connect(m_dataset,SIGNAL(seriesAdded(QAbstractSeries*,Domain*)),m_presenter,SLOT(handleSeriesAdded(QAbstractSeries*,Domain*)));
460 QObject::connect(m_dataset,SIGNAL(seriesAdded(QAbstractSeries*,Domain*)),m_presenter,SLOT(handleSeriesAdded(QAbstractSeries*,Domain*)));
461 QObject::connect(m_dataset,SIGNAL(seriesRemoved(QAbstractSeries*)),m_presenter,SLOT(handleSeriesRemoved(QAbstractSeries*)));
461 QObject::connect(m_dataset,SIGNAL(seriesRemoved(QAbstractSeries*)),m_presenter,SLOT(handleSeriesRemoved(QAbstractSeries*)));
462 QObject::connect(m_dataset,SIGNAL(axisAdded(QAbstractAxis*,Domain*)),m_presenter,SLOT(handleAxisAdded(QAbstractAxis*,Domain*)));
462 QObject::connect(m_dataset,SIGNAL(axisAdded(QAbstractAxis*,Domain*)),m_presenter,SLOT(handleAxisAdded(QAbstractAxis*,Domain*)));
463 QObject::connect(m_dataset,SIGNAL(axisRemoved(QAbstractAxis*)),m_presenter,SLOT(handleAxisRemoved(QAbstractAxis*)));
463 QObject::connect(m_dataset,SIGNAL(axisRemoved(QAbstractAxis*)),m_presenter,SLOT(handleAxisRemoved(QAbstractAxis*)));
464 //QObject::connect(m_presenter, SIGNAL(marginsChanged(QRectF)), q_ptr, SIGNAL(marginsChanged(QRectF)));
464 //QObject::connect(m_presenter, SIGNAL(marginsChanged(QRectF)), q_ptr, SIGNAL(marginsChanged(QRectF)));
465 }
465 }
466
466
467 #include "moc_qchart.cpp"
467 #include "moc_qchart.cpp"
468
468
469 QTCOMMERCIALCHART_END_NAMESPACE
469 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now