|
@@
-1,31
+1,67
|
|
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 <QtGui/QApplication>
|
|
21
|
#include <QApplication>
|
|
22
|
#include "splinewidget.h"
|
|
22
|
#include <QMainWindow>
|
|
|
|
|
23
|
#include <QChartView>
|
|
|
|
|
24
|
#include <QSplineSeries>
|
|
|
|
|
25
|
|
|
|
|
|
26
|
QTCOMMERCIALCHART_USE_NAMESPACE
|
|
23
|
|
|
27
|
|
|
24
|
int main(int argc, char *argv[])
|
|
28
|
int main(int argc, char *argv[])
|
|
25
|
{
|
|
29
|
{
|
|
26
|
QApplication a(argc, argv);
|
|
30
|
QApplication a(argc, argv);
|
|
27
|
SplineWidget w;
|
|
31
|
|
|
28
|
w.show();
|
|
32
|
//![1]
|
|
29
|
|
|
33
|
QSplineSeries* series = new QSplineSeries();
|
|
|
|
|
34
|
QPen red(Qt::red);
|
|
|
|
|
35
|
red.setWidth(3);
|
|
|
|
|
36
|
series->setPen(red);
|
|
|
|
|
37
|
//![1]
|
|
|
|
|
38
|
|
|
|
|
|
39
|
//![2]
|
|
|
|
|
40
|
series->append(0, 6);
|
|
|
|
|
41
|
series->append(2, 4);
|
|
|
|
|
42
|
series->append(3, 8);
|
|
|
|
|
43
|
series->append(7, 4);
|
|
|
|
|
44
|
series->append(10, 5);
|
|
|
|
|
45
|
*series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
|
|
|
|
|
46
|
//![2]
|
|
|
|
|
47
|
|
|
|
|
|
48
|
//![3]
|
|
|
|
|
49
|
QChart* chart = new QChart();
|
|
|
|
|
50
|
chart->addSeries(series);
|
|
|
|
|
51
|
chart->setTitle("Simple spline chart example");
|
|
|
|
|
52
|
//![3]
|
|
|
|
|
53
|
|
|
|
|
|
54
|
//![4]
|
|
|
|
|
55
|
QChartView* chartView = new QChartView(chart);
|
|
|
|
|
56
|
chartView->setRenderHint(QPainter::Antialiasing);
|
|
|
|
|
57
|
//![4]
|
|
|
|
|
58
|
|
|
|
|
|
59
|
//![5]
|
|
|
|
|
60
|
QMainWindow window;
|
|
|
|
|
61
|
window.setCentralWidget(chartView);
|
|
|
|
|
62
|
window.resize(400, 300);
|
|
|
|
|
63
|
window.show();
|
|
|
|
|
64
|
//![5]
|
|
|
|
|
65
|
|
|
30
|
return a.exec();
|
|
66
|
return a.exec();
|
|
31
|
}
|
|
67
|
}
|