@@ -18,14 +18,50 | |||||
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#include <Q |
|
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 | } |
@@ -2,6 +2,7 | |||||
2 | error( "Couldn't find the examples.pri file!" ) |
|
2 | error( "Couldn't find the examples.pri file!" ) | |
3 | } |
|
3 | } | |
4 | TARGET = splinechart |
|
4 | TARGET = splinechart | |
5 |
SOURCES += main.cpp |
|
5 | SOURCES += main.cpp | |
6 | splinewidget.cpp |
|
6 | ||
7 | HEADERS += splinewidget.h |
|
7 | ||
|
8 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now