##// END OF EJS Templates
Docs update
Marek Rosa -
r2358:9d5a354692be
parent child
Show More
@@ -0,0 +1,8
1 /*!
2 \example demos/audio
3 \title Audio demo
4 \subtitle
5
6 This demos shows drawing of the dynamic data (microphon input)
7 \image demos_audio.png
8 */
@@ -0,0 +1,12
1 /*!
2 \example demos/callout
3 \title Callout demo
4 \subtitle
5
6 This demo shows how to draw an additional element (a callout) on top of the chart.
7 \image demos_callout.png
8
9 QChart class provides two methods that map between the scene coordinates and the series' domain (defines by the axes ranges).
10 QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series)
11 QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series)
12 */
1 NO CONTENT: file renamed from examples/callout/callout.cpp to demos/callout/callout.cpp
NO CONTENT: file renamed from examples/callout/callout.cpp to demos/callout/callout.cpp
1 NO CONTENT: file renamed from examples/callout/callout.h to demos/callout/callout.h
NO CONTENT: file renamed from examples/callout/callout.h to demos/callout/callout.h
@@ -1,15 +1,15
1 !include( ../examples.pri ) {
1 !include( ../demos.pri ) {
2 error( "Couldn't find the examples.pri file!" )
2 error( "Couldn't find the examples.pri file!" )
3 }
3 }
4
4
5 TARGET = callout
5 TARGET = callout
6 TEMPLATE = app
6 TEMPLATE = app
7
7
8 SOURCES += \
8 SOURCES += \
9 main.cpp\
9 main.cpp\
10 callout.cpp \
10 callout.cpp \
11 view.cpp
11 view.cpp
12
12
13 HEADERS += \
13 HEADERS += \
14 callout.h \
14 callout.h \
15 view.h
15 view.h
1 NO CONTENT: file renamed from examples/callout/main.cpp to demos/callout/main.cpp
NO CONTENT: file renamed from examples/callout/main.cpp to demos/callout/main.cpp
@@ -1,123 +1,125
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 "view.h"
21 #include "view.h"
22 #include <QResizeEvent>
22 #include <QResizeEvent>
23 #include <QGraphicsScene>
23 #include <QGraphicsScene>
24 #include <QChart>
24 #include <QChart>
25 #include <QLineSeries>
25 #include <QLineSeries>
26 #include <QSplineSeries>
26 #include <QSplineSeries>
27 #include <QGraphicsTextItem>
27 #include <QGraphicsTextItem>
28 #include "callout.h"
28 #include "callout.h"
29 #include <QMouseEvent>
29 #include <QMouseEvent>
30
30
31 View::View(QWidget *parent)
31 View::View(QWidget *parent)
32 : QGraphicsView(new QGraphicsScene, parent),
32 : QGraphicsView(new QGraphicsScene, parent),
33 m_coordX(0),
33 m_coordX(0),
34 m_coordY(0),
34 m_coordY(0),
35 m_chart(0),
35 m_chart(0),
36 m_tooltip(0)
36 m_tooltip(0)
37 {
37 {
38 setDragMode(QGraphicsView::NoDrag);
38 setDragMode(QGraphicsView::NoDrag);
39 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
39 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
40 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
40 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
41
41
42 // chart
42 // chart
43 m_chart = new QChart;
43 m_chart = new QChart;
44 m_chart->setMinimumSize(640, 480);
44 m_chart->setMinimumSize(640, 480);
45 m_chart->setTitle("Hover the line to show callout. Click the line to make it stay");
45 m_chart->setTitle("Hover the line to show callout. Click the line to make it stay");
46 m_chart->legend()->hide();
46 m_chart->legend()->hide();
47 QLineSeries *series = new QLineSeries;
47 QLineSeries *series = new QLineSeries;
48 series->append(1, 3);
48 series->append(1, 3);
49 series->append(4, 5);
49 series->append(4, 5);
50 series->append(5, 4.5);
50 series->append(5, 4.5);
51 series->append(7, 1);
51 series->append(7, 1);
52 series->append(11, 2);
52 series->append(11, 2);
53 m_chart->addSeries(series);
53 m_chart->addSeries(series);
54
54
55 QSplineSeries *series2 = new QSplineSeries;
55 QSplineSeries *series2 = new QSplineSeries;
56 series2->append(1.6, 1.4);
56 series2->append(1.6, 1.4);
57 series2->append(2.4, 3.5);
57 series2->append(2.4, 3.5);
58 series2->append(3.7, 2.5);
58 series2->append(3.7, 2.5);
59 series2->append(7, 4);
59 series2->append(7, 4);
60 series2->append(10, 2);
60 series2->append(10, 2);
61 m_chart->addSeries(series2);
61 m_chart->addSeries(series2);
62
62
63 m_chart->createDefaultAxes();
63 m_chart->createDefaultAxes();
64 m_chart->setAcceptHoverEvents(true);
64 m_chart->setAcceptHoverEvents(true);
65
65
66 setRenderHint(QPainter::Antialiasing);
66 setRenderHint(QPainter::Antialiasing);
67 scene()->addItem(m_chart);
67 scene()->addItem(m_chart);
68
68
69 m_coordX = new QGraphicsSimpleTextItem(m_chart);
69 m_coordX = new QGraphicsSimpleTextItem(m_chart);
70 m_coordX->setPos(m_chart->size().width()/2 - 50, m_chart->size().height());
70 m_coordX->setPos(m_chart->size().width()/2 - 50, m_chart->size().height());
71 m_coordX->setText("X: ");
71 m_coordX->setText("X: ");
72 m_coordY = new QGraphicsSimpleTextItem(m_chart);
72 m_coordY = new QGraphicsSimpleTextItem(m_chart);
73 m_coordY->setPos(m_chart->size().width()/2 + 50, m_chart->size().height());
73 m_coordY->setPos(m_chart->size().width()/2 + 50, m_chart->size().height());
74 m_coordY->setText("Y: ");
74 m_coordY->setText("Y: ");
75
75
76 connect(series, SIGNAL(clicked(QPointF)), this, SLOT(keepCallout()));
76 connect(series, SIGNAL(clicked(QPointF)), this, SLOT(keepCallout()));
77 connect(series, SIGNAL(hovered(QPointF, bool)), this, SLOT(tooltip(QPointF,bool)));
77 connect(series, SIGNAL(hovered(QPointF, bool)), this, SLOT(tooltip(QPointF,bool)));
78
78
79 connect(series2, SIGNAL(clicked(QPointF)), this, SLOT(keepCallout()));
79 connect(series2, SIGNAL(clicked(QPointF)), this, SLOT(keepCallout()));
80 connect(series2, SIGNAL(hovered(QPointF, bool)), this, SLOT(tooltip(QPointF,bool)));
80 connect(series2, SIGNAL(hovered(QPointF, bool)), this, SLOT(tooltip(QPointF,bool)));
81
81
82 this->setMouseTracking(true);
82 this->setMouseTracking(true);
83 }
83 }
84
84
85 void View::resizeEvent(QResizeEvent *event)
85 void View::resizeEvent(QResizeEvent *event)
86 {
86 {
87 if (scene()) {
87 if (scene()) {
88 scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
88 scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
89 m_chart->resize(event->size());
89 m_chart->resize(event->size());
90 m_coordX->setPos(m_chart->size().width()/2 - 50, m_chart->size().height() - 20);
90 m_coordX->setPos(m_chart->size().width()/2 - 50, m_chart->size().height() - 20);
91 m_coordY->setPos(m_chart->size().width()/2 + 50, m_chart->size().height() - 20);
91 m_coordY->setPos(m_chart->size().width()/2 + 50, m_chart->size().height() - 20);
92 // for (int i = 0; i < children().count(); i++)
93 // if ()
92 }
94 }
93 QGraphicsView::resizeEvent(event);
95 QGraphicsView::resizeEvent(event);
94 }
96 }
95
97
96 void View::mouseMoveEvent(QMouseEvent *event)
98 void View::mouseMoveEvent(QMouseEvent *event)
97 {
99 {
98 m_coordX->setText(QString("X: %1").arg(m_chart->mapToValue(event->pos()).x()));
100 m_coordX->setText(QString("X: %1").arg(m_chart->mapToValue(event->pos()).x()));
99 m_coordY->setText(QString("Y: %1").arg(m_chart->mapToValue(event->pos()).y()));
101 m_coordY->setText(QString("Y: %1").arg(m_chart->mapToValue(event->pos()).y()));
100 QGraphicsView::mouseMoveEvent(event);
102 QGraphicsView::mouseMoveEvent(event);
101 }
103 }
102
104
103 void View::keepCallout()
105 void View::keepCallout()
104 {
106 {
105 m_tooltip = new Callout(m_chart);
107 m_tooltip = new Callout(m_chart);
106 }
108 }
107
109
108 void View::tooltip(QPointF point, bool state)
110 void View::tooltip(QPointF point, bool state)
109 {
111 {
110 if (m_tooltip == 0)
112 if (m_tooltip == 0)
111 m_tooltip = new Callout(m_chart);
113 m_tooltip = new Callout(m_chart);
112
114
113 if (state) {
115 if (state) {
114 m_tooltip->setText(QString("X: %1 \nY: %2 ").arg(point.x()).arg(point.y()));
116 m_tooltip->setText(QString("X: %1 \nY: %2 ").arg(point.x()).arg(point.y()));
115 QXYSeries *series = qobject_cast<QXYSeries *>(sender());
117 QXYSeries *series = qobject_cast<QXYSeries *>(sender());
116 m_tooltip->setAnchor(m_chart->mapToPosition(point, series));
118 m_tooltip->setAnchor(m_chart->mapToPosition(point, series));
117 m_tooltip->setPos(m_chart->mapToPosition(point, series) + QPoint(10, -50));
119 m_tooltip->setPos(m_chart->mapToPosition(point, series) + QPoint(10, -50));
118 m_tooltip->setZValue(11);
120 m_tooltip->setZValue(11);
119 m_tooltip->show();
121 m_tooltip->show();
120 } else {
122 } else {
121 m_tooltip->hide();
123 m_tooltip->hide();
122 }
124 }
123 }
125 }
1 NO CONTENT: file renamed from examples/callout/view.h to demos/callout/view.h
NO CONTENT: file renamed from examples/callout/view.h to demos/callout/view.h
@@ -1,31 +1,32
1 CURRENTLY_BUILDING_COMPONENTS = "demos"
1 CURRENTLY_BUILDING_COMPONENTS = "demos"
2 !include( ../config.pri ) {
2 !include( ../config.pri ) {
3 error( "Couldn't find the config.pri file!" )
3 error( "Couldn't find the config.pri file!" )
4 }
4 }
5
5
6 TEMPLATE = subdirs
6 TEMPLATE = subdirs
7 SUBDIRS += piechartcustomization \
7 SUBDIRS += piechartcustomization \
8 dynamicspline \
8 dynamicspline \
9 nesteddonuts \
9 nesteddonuts \
10 qmlchart \
10 qmlchart \
11 qmlweather \
11 qmlweather \
12 qmlf1legends \
12 qmlf1legends \
13 qmlcustomizations \
13 qmlcustomizations \
14 qmlcustommodel \
14 qmlcustommodel \
15 chartinteractions \
15 chartinteractions \
16 qmlaxes \
16 qmlaxes \
17 qmlcustomlegend
17 qmlcustomlegend \
18 callout
18
19
19 contains(QT_CONFIG, opengl) {
20 contains(QT_CONFIG, opengl) {
20 SUBDIRS += chartthemes \
21 SUBDIRS += chartthemes \
21 qmloscilloscope \
22 qmloscilloscope \
22 chartviewer
23 chartviewer
23 } else {
24 } else {
24 message("OpenGL not available. Some demos are disabled")
25 message("OpenGL not available. Some demos are disabled")
25 }
26 }
26
27
27 contains(QT_CONFIG, multimedia) {
28 contains(QT_CONFIG, multimedia) {
28 SUBDIRS += audio
29 SUBDIRS += audio
29 } else {
30 } else {
30 message("QtMultimedia library not available. Some demos are disabled")
31 message("QtMultimedia library not available. Some demos are disabled")
31 }
32 }
1 NO CONTENT: file renamed from doc/images/examples_callout.png to doc/images/demos_callout.png
NO CONTENT: file renamed from doc/images/examples_callout.png to doc/images/demos_callout.png
@@ -1,67 +1,75
1 /*!
1 /*!
2 \page demos.html
2 \page demos.html
3 \keyword Demos
3 \keyword Demos
4
4
5 \raw HTML
5 \raw HTML
6 <div class="qchart">
6 <div class="qchart">
7
7
8 <table>
8 <table>
9 <tr>
9 <tr>
10 <td><a href="demos-chartthemes.html">Chart Themes</a></td>
10 <td><a href="demos-chartthemes.html">Chart Themes</a></td>
11 <td><a href="demos-dynamicspline.html">Dynamic Spline Chart</a></td>
11 <td><a href="demos-dynamicspline.html">Dynamic Spline Chart</a></td>
12 </tr>
12 </tr>
13 <tr>
13 <tr>
14 <td><a href="demos-chartthemes.html"><img src="images/demo_chartthemes_blue_cerulean.png" width="300" alt="Chart Themes" /></a></td>
14 <td><a href="demos-chartthemes.html"><img src="images/demo_chartthemes_blue_cerulean.png" width="300" alt="Chart Themes" /></a></td>
15 <td><a href="demos-dynamicspline.html"><img src="images/demos_dynamicspline2.png" width="300" alt="Dynamic Spline" /></a></td>
15 <td><a href="demos-dynamicspline.html"><img src="images/demos_dynamicspline2.png" width="300" alt="Dynamic Spline" /></a></td>
16 </tr>
16 </tr>
17
17
18 <tr>
18 <tr>
19 <td><a href="demos-nesteddonuts.html">Nested Donuts Chart</a></td>
19 <td><a href="demos-nesteddonuts.html">Nested Donuts Chart</a></td>
20 <td><a href="demos-piechartcustomization.html">Pie Chart Customization</a></td>
20 <td><a href="demos-piechartcustomization.html">Pie Chart Customization</a></td>
21 </tr>
21 </tr>
22 <tr>
22 <tr>
23 <td><a href="demos-nesteddonuts.html"><img src="images/demos_nesteddonuts.png" width="300" alt="Nested Donuts Chart" /></a></td>
23 <td><a href="demos-nesteddonuts.html"><img src="images/demos_nesteddonuts.png" width="300" alt="Nested Donuts Chart" /></a></td>
24 <td><a href="demos-piechartcustomization.html"><img src="images/piechart_customization.png" width="300" alt="Pie Chart Customization" /></a></td>
24 <td><a href="demos-piechartcustomization.html"><img src="images/piechart_customization.png" width="300" alt="Pie Chart Customization" /></a></td>
25 </tr>
25 </tr>
26
26
27 <tr>
27 <tr>
28 <td><a href="demos-qmlchart.html">Qml Basic Charts</a></td>
28 <td><a href="demos-qmlchart.html">Qml Basic Charts</a></td>
29 <td><a href="demos-qmlaxes.html">Qml Axes</a></td>
29 <td><a href="demos-qmlaxes.html">Qml Axes</a></td>
30 </tr>
30 </tr>
31 <tr>
31 <tr>
32 <td><a href="demos-qmlchart.html"><img src="images/demos_qmlchart1.png" width="300" alt="Qml Basic Charts" /></a></td>
32 <td><a href="demos-qmlchart.html"><img src="images/demos_qmlchart1.png" width="300" alt="Qml Basic Charts" /></a></td>
33 <td><a href="demos-qmlaxes.html"><img src="images/demos_qmlaxes1.png" width="300" alt="Qml Axes" /></a></td>
33 <td><a href="demos-qmlaxes.html"><img src="images/demos_qmlaxes1.png" width="300" alt="Qml Axes" /></a></td>
34 </tr>
34 </tr>
35
35
36 <tr>
36 <tr>
37 <td><a href="demos-qmlcustomizations.html">Qml Customizations</a></td>
37 <td><a href="demos-qmlcustomizations.html">Qml Customizations</a></td>
38 <td><a href="demos-qmlcustommodel.html">Qml Custom Model</a></td>
38 <td><a href="demos-qmlcustommodel.html">Qml Custom Model</a></td>
39 </tr>
39 </tr>
40 <tr>
40 <tr>
41 <td><a href="demos-qmlcustomizations.html"><img src="images/demos_qmlcustomizations.png" width="300" alt="Qml Customizations" /></a></td>
41 <td><a href="demos-qmlcustomizations.html"><img src="images/demos_qmlcustomizations.png" width="300" alt="Qml Customizations" /></a></td>
42 <td><a href="demos-qmlcustommodel.html"><img src="images/demos_qmlcustommodel.png" width="300" alt="Qml Custom Model" /></a></td>
42 <td><a href="demos-qmlcustommodel.html"><img src="images/demos_qmlcustommodel.png" width="300" alt="Qml Custom Model" /></a></td>
43 </tr>
43 </tr>
44
44
45 <tr>
45 <tr>
46 <td><a href="demos-qmlf1legends.html">Qml F1 Legends</a></td>
46 <td><a href="demos-qmlf1legends.html">Qml F1 Legends</a></td>
47 <td><a href="demos-qmloscilloscope.html">Qml Oscilloscope</a></td>
47 <td><a href="demos-qmloscilloscope.html">Qml Oscilloscope</a></td>
48 </tr>
48 </tr>
49 <tr>
49 <tr>
50 <td><a href="demos-qmlf1legends.html"><img src="images/demos_qmlf1legends.png" width="300" alt="Qml F1 Legends" /></a></td>
50 <td><a href="demos-qmlf1legends.html"><img src="images/demos_qmlf1legends.png" width="300" alt="Qml F1 Legends" /></a></td>
51 <td><a href="demos-qmloscilloscope.html"><img src="images/demos_qmloscilloscope.png" width="300" alt="Qml Oscilloscope" /></a></td>
51 <td><a href="demos-qmloscilloscope.html"><img src="images/demos_qmloscilloscope.png" width="300" alt="Qml Oscilloscope" /></a></td>
52 </tr>
52 </tr>
53
53
54 <tr>
54 <tr>
55 <td><a href="demos-qmlweather.html">Qml Weather</a></td>
55 <td><a href="demos-qmlweather.html">Qml Weather</a></td>
56 <td><a href="demos-qmlcustomlegend.html">Qml Custom Legend</a></td>
56 <td><a href="demos-qmlcustomlegend.html">Qml Custom Legend</a></td>
57 </tr>
57 </tr>
58 <tr>
58 <tr>
59 <td><a href="demos-qmlweather.html"><img src="images/demos_qmlweather.png" width="300" alt="Qml Weather" /></a></td>
59 <td><a href="demos-qmlweather.html"><img src="images/demos_qmlweather.png" width="300" alt="Qml Weather" /></a></td>
60 <td><a href="demos-qmlcustomlegend.html"><img src="images/demos-qmlcustomlegend1.png" width="300" alt="Qml Custom Legend" /></a></td>
60 <td><a href="demos-qmlcustomlegend.html"><img src="images/demos-qmlcustomlegend1.png" width="300" alt="Qml Custom Legend" /></a></td>
61 </tr>
61 </tr>
62 <tr>
63 <td><a href="demos-callout.html">Callout</a></td>
64 <td><a href="demos-audio.html">Audio</a></td>
65 </tr>
66 <tr>
67 <td><a href="demos-callout.html"><img src="images/demos_callout.png" width="300" alt="Callout" /></a></td>
68 <td><a href="demos-audio.html"><img src="images/demos_audio.png" width="300" alt="Audio" /></a></td>
69 </tr>
62
70
63 </table>
71 </table>
64 </div>
72 </div>
65 \endraw
73 \endraw
66
74
67 */
75 */
@@ -1,40 +1,39
1 CURRENTLY_BUILDING_COMPONENTS = "examples"
1 CURRENTLY_BUILDING_COMPONENTS = "examples"
2 !include( ../config.pri ) {
2 !include( ../config.pri ) {
3 error( "Couldn't find the config.pri file!" )
3 error( "Couldn't find the config.pri file!" )
4 }
4 }
5
5
6 TEMPLATE = subdirs
6 TEMPLATE = subdirs
7 SUBDIRS += \
7 SUBDIRS += \
8 areachart \
8 areachart \
9 customchart \
9 customchart \
10 linechart \
10 linechart \
11 percentbarchart \
11 percentbarchart \
12 piechart \
12 piechart \
13 piechartdrilldown \
13 piechartdrilldown \
14 presenterchart \
14 presenterchart \
15 scatterchart \
15 scatterchart \
16 scatterinteractions \
16 scatterinteractions \
17 splinechart \
17 splinechart \
18 stackedbarchart \
18 stackedbarchart \
19 stackedbarchartdrilldown \
19 stackedbarchartdrilldown \
20 zoomlinechart \
20 zoomlinechart \
21 modeldata \
21 modeldata \
22 barchart \
22 barchart \
23 legend \
23 legend \
24 barmodelmapper \
24 barmodelmapper \
25 qmlpiechart \
25 qmlpiechart \
26 lineandbar \
26 lineandbar \
27 horizontalbarchart \
27 horizontalbarchart \
28 horizontalstackedbarchart \
28 horizontalstackedbarchart \
29 horizontalpercentbarchart \
29 horizontalpercentbarchart \
30 donutbreakdown \
30 donutbreakdown \
31 temperaturerecords \
31 temperaturerecords \
32 donutchart \
32 donutchart \
33 multiaxis \
33 multiaxis \
34 callout \
35 legendmarkers
34 legendmarkers
36
35
37 !linux-arm*: {
36 !linux-arm*: {
38 SUBDIRS += \
37 SUBDIRS += \
39 datetimeaxis
38 datetimeaxis
40 }
39 }
General Comments 0
You need to be logged in to leave comments. Login now