##// END OF EJS Templates
Documentation for Qml F1 Legends demo
Tero Ahola -
r1391:de088eac0b44
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,20
1 /*!
2 \example demos/qmlf1legends
3 \title Qml F1 Legends
4 \subtitle
5
6 \image demos_qmlf1legends.png
7
8 This application demonstrates using XmlListModel as a datasource for a Chart.
9
10 Let's define an empty ChartView first:
11 \snippet ../demos/qmlf1legends/qml/qmlf1legends/main.qml 1
12
13 Our XmlListModel uses hard-coded test data. In a real application the data source would be a timing system.
14 \snippet ../demos/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml 1
15 \snippet ../demos/qmlf1legends/qml/qmlf1legends/SpeedsXml.qml 2
16 \snippet ../demos/qmlf1legends/qml/qmlf1legends/main.qml 2
17
18 The data is parsed with a timer. The line series representing each driver are created on the fly.
19 \snippet ../demos/qmlf1legends/qml/qmlf1legends/main.qml 3
20 */
@@ -20,12 +20,77
20
20
21 import QtQuick 1.1
21 import QtQuick 1.1
22
22
23 //![1]
23 XmlListModel {
24 XmlListModel {
24 // Hard-coded test data
25 // Hard-coded test data
25 xml: "<results><row><speedTrap>0</speedTrap><driver>Fittipaldi</driver><speed>104.12</speed></row><row><speedTrap>0</speedTrap><driver>Stewart</driver><speed>106.12</speed></row><row><speedTrap>0</speedTrap><driver>Hunt</driver><speed>106.12</speed></row><row><speedTrap>1</speedTrap><driver>Fittipaldi</driver><speed>115.12</speed></row><row><speedTrap>1</speedTrap><driver>Stewart</driver><speed>114.12</speed></row><row><speedTrap>1</speedTrap><driver>Hunt</driver><speed>115.12</speed></row><row><speedTrap>2</speedTrap><driver>Hunt</driver><speed>165.23</speed></row><row><speedTrap>2</speedTrap><driver>Fittipaldi</driver><speed>175.23</speed></row><row><speedTrap>2</speedTrap><driver>Stewart</driver><speed>168.23</speed></row><row><speedTrap>3</speedTrap><driver>Hunt</driver><speed>104.87</speed></row><row><speedTrap>3</speedTrap><driver>Fittipaldi</driver><speed>104.43</speed></row><row><speedTrap>3</speedTrap><driver>Stewart</driver><speed>94.83</speed></row><row><speedTrap>4</speedTrap><driver>Hunt</driver><speed>107.87</speed></row><row><speedTrap>4</speedTrap><driver>Fittipaldi</driver><speed>111.84</speed></row><row><speedTrap>4</speedTrap><driver>Stewart</driver><speed>106.84</speed></row><row><speedTrap>5</speedTrap><driver>Hunt</driver><speed>94.87</speed></row><row><speedTrap>5</speedTrap><driver>Stewart</driver><speed>92.37</speed></row><row><speedTrap>5</speedTrap><driver>Fittipaldi</driver><speed>99.37</speed></row><row><speedTrap>6</speedTrap><driver>Hunt</driver><speed>52.87</speed></row><row><speedTrap>6</speedTrap><driver>Fittipaldi</driver><speed>42.87</speed></row><row><speedTrap>6</speedTrap><driver>Stewart</driver><speed>55.87</speed></row><row><speedTrap>7</speedTrap><driver>Hunt</driver><speed>77.87</speed></row><row><speedTrap>7</speedTrap><driver>Fittipaldi</driver><speed>72.87</speed></row><row><speedTrap>7</speedTrap><driver>Stewart</driver><speed>87.87</speed></row><row><speedTrap>8</speedTrap><driver>Hunt</driver><speed>94.17</speed></row><row><speedTrap>8</speedTrap><driver>Fittipaldi</driver><speed>98.17</speed></row><row><speedTrap>8</speedTrap><driver>Stewart</driver><speed>84.17</speed></row><row><speedTrap>9</speedTrap><driver>Hunt</driver><speed>91.87</speed></row><row><speedTrap>9</speedTrap><driver>Fittipaldi</driver><speed>71.87</speed></row><row><speedTrap>9</speedTrap><driver>Stewart</driver><speed>81.87</speed></row><row><speedTrap>10</speedTrap><driver>Hunt</driver><speed>104.87</speed></row><row><speedTrap>10</speedTrap><driver>Fittipaldi</driver><speed>115.87</speed></row><row><speedTrap>10</speedTrap><driver>Stewart</driver><speed>119.87</speed></row><row><speedTrap>11</speedTrap><driver>Hunt</driver><speed>162.87</speed></row><row><speedTrap>11</speedTrap><driver>Fittipaldi</driver><speed>155.84</speed></row><row><speedTrap>11</speedTrap><driver>Stewart</driver><speed>152.84</speed></row><row><speedTrap>12</speedTrap><driver>Hunt</driver><speed>181.87</speed></row><row><speedTrap>12</speedTrap><driver>Fittipaldi</driver><speed>161.85</speed></row><row><speedTrap>12</speedTrap><driver>Stewart</driver><speed>167.85</speed></row><row><speedTrap>13</speedTrap><driver>Hunt</driver><speed>155.87</speed></row><row><speedTrap>13</speedTrap><driver>Fittipaldi</driver><speed>154.87</speed></row><row><speedTrap>13</speedTrap><driver>Stewart</driver><speed>164.87</speed></row><row><speedTrap>14</speedTrap><driver>Hunt</driver><speed>197.57</speed></row><row><speedTrap>14</speedTrap><driver>Fittipaldi</driver><speed>187.54</speed></row><row><speedTrap>14</speedTrap><driver>Stewart</driver><speed>180.54</speed></row><row><speedTrap>15</speedTrap><driver>Fittipaldi</driver><speed>216.87</speed></row><row><speedTrap>15</speedTrap><driver>Hunt</driver><speed>207.87</speed></row><row><speedTrap>15</speedTrap><driver>Stewart</driver><speed>197.87</speed></row><row><speedTrap>16</speedTrap><driver>Hunt</driver><speed>82.87</speed></row><row><speedTrap>16</speedTrap><driver>Fittipaldi</driver><speed>79.37</speed></row><row><speedTrap>16</speedTrap><driver>Stewart</driver><speed>85.37</speed></row><row><speedTrap>17</speedTrap><driver>Hunt</driver><speed>153.87</speed></row><row><speedTrap>17</speedTrap><driver>Fittipaldi</driver><speed>143.87</speed></row><row><speedTrap>17</speedTrap><driver>Stewart</driver><speed>133.87</speed></row><row><speedTrap>18</speedTrap><driver>Hunt</driver><speed>89.87</speed></row><row><speedTrap>18</speedTrap><driver>Fittipaldi</driver><speed>95.85</speed></row><row><speedTrap>18</speedTrap><driver>Stewart</driver><speed>98.85</speed></row><row><speedTrap>19</speedTrap><driver>Hunt</driver><speed>169.87</speed></row><row><speedTrap>19</speedTrap><driver>Stewart</driver><speed>167.87</speed></row><row><speedTrap>19</speedTrap><driver>Fittipaldi</driver><speed>154.87</speed></row></results>"
26 xml: "<results><row><speedTrap>0</speedTrap><driver>Fittipaldi</driver><speed>104.12</speed></row>"
27 +"<row><speedTrap>0</speedTrap><driver>Stewart</driver><speed>106.12</speed></row>"
28 // ...
29 //![1]
30 +"<row><speedTrap>0</speedTrap><driver>Hunt</driver><speed>106.12</speed></row>"
31 +"<row><speedTrap>1</speedTrap><driver>Fittipaldi</driver><speed>115.12</speed></row>"
32 +"<row><speedTrap>1</speedTrap><driver>Stewart</driver><speed>114.12</speed></row>"
33 +"<row><speedTrap>1</speedTrap><driver>Hunt</driver><speed>115.12</speed></row>"
34 +"<row><speedTrap>2</speedTrap><driver>Hunt</driver><speed>165.23</speed></row>"
35 +"<row><speedTrap>2</speedTrap><driver>Fittipaldi</driver><speed>175.23</speed></row>"
36 +"<row><speedTrap>2</speedTrap><driver>Stewart</driver><speed>168.23</speed></row>"
37 +"<row><speedTrap>3</speedTrap><driver>Hunt</driver><speed>104.87</speed></row>"
38 +"<row><speedTrap>3</speedTrap><driver>Fittipaldi</driver><speed>104.43</speed></row>"
39 +"<row><speedTrap>3</speedTrap><driver>Stewart</driver><speed>94.83</speed></row>"
40 +"<row><speedTrap>4</speedTrap><driver>Hunt</driver><speed>107.87</speed></row>"
41 +"<row><speedTrap>4</speedTrap><driver>Fittipaldi</driver><speed>111.84</speed></row>"
42 +"<row><speedTrap>4</speedTrap><driver>Stewart</driver><speed>106.84</speed></row>"
43 +"<row><speedTrap>5</speedTrap><driver>Hunt</driver><speed>94.87</speed></row>"
44 +"<row><speedTrap>5</speedTrap><driver>Stewart</driver><speed>92.37</speed></row>"
45 +"<row><speedTrap>5</speedTrap><driver>Fittipaldi</driver><speed>99.37</speed></row>"
46 +"<row><speedTrap>6</speedTrap><driver>Hunt</driver><speed>52.87</speed></row>"
47 +"<row><speedTrap>6</speedTrap><driver>Fittipaldi</driver><speed>42.87</speed></row>"
48 +"<row><speedTrap>6</speedTrap><driver>Stewart</driver><speed>55.87</speed></row>"
49 +"<row><speedTrap>7</speedTrap><driver>Hunt</driver><speed>77.87</speed></row>"
50 +"<row><speedTrap>7</speedTrap><driver>Fittipaldi</driver><speed>72.87</speed></row>"
51 +"<row><speedTrap>7</speedTrap><driver>Stewart</driver><speed>87.87</speed></row>"
52 +"<row><speedTrap>8</speedTrap><driver>Hunt</driver><speed>94.17</speed></row>"
53 +"<row><speedTrap>8</speedTrap><driver>Fittipaldi</driver><speed>98.17</speed></row>"
54 +"<row><speedTrap>8</speedTrap><driver>Stewart</driver><speed>84.17</speed></row>"
55 +"<row><speedTrap>9</speedTrap><driver>Hunt</driver><speed>91.87</speed></row>"
56 +"<row><speedTrap>9</speedTrap><driver>Fittipaldi</driver><speed>71.87</speed></row>"
57 +"<row><speedTrap>9</speedTrap><driver>Stewart</driver><speed>81.87</speed></row>"
58 +"<row><speedTrap>10</speedTrap><driver>Hunt</driver><speed>104.87</speed></row>"
59 +"<row><speedTrap>10</speedTrap><driver>Fittipaldi</driver><speed>115.87</speed></row>"
60 +"<row><speedTrap>10</speedTrap><driver>Stewart</driver><speed>119.87</speed></row>"
61 +"<row><speedTrap>11</speedTrap><driver>Hunt</driver><speed>162.87</speed></row>"
62 +"<row><speedTrap>11</speedTrap><driver>Fittipaldi</driver><speed>155.84</speed></row>"
63 +"<row><speedTrap>11</speedTrap><driver>Stewart</driver><speed>152.84</speed></row>"
64 +"<row><speedTrap>12</speedTrap><driver>Hunt</driver><speed>181.87</speed></row>"
65 +"<row><speedTrap>12</speedTrap><driver>Fittipaldi</driver><speed>161.85</speed></row>"
66 +"<row><speedTrap>12</speedTrap><driver>Stewart</driver><speed>167.85</speed></row>"
67 +"<row><speedTrap>13</speedTrap><driver>Hunt</driver><speed>155.87</speed></row>"
68 +"<row><speedTrap>13</speedTrap><driver>Fittipaldi</driver><speed>154.87</speed></row>"
69 +"<row><speedTrap>13</speedTrap><driver>Stewart</driver><speed>164.87</speed></row>"
70 +"<row><speedTrap>14</speedTrap><driver>Hunt</driver><speed>197.57</speed></row>"
71 +"<row><speedTrap>14</speedTrap><driver>Fittipaldi</driver><speed>187.54</speed></row>"
72 +"<row><speedTrap>14</speedTrap><driver>Stewart</driver><speed>180.54</speed></row>"
73 +"<row><speedTrap>15</speedTrap><driver>Fittipaldi</driver><speed>216.87</speed></row>"
74 +"<row><speedTrap>15</speedTrap><driver>Hunt</driver><speed>207.87</speed></row>"
75 +"<row><speedTrap>15</speedTrap><driver>Stewart</driver><speed>197.87</speed></row>"
76 +"<row><speedTrap>16</speedTrap><driver>Hunt</driver><speed>82.87</speed></row>"
77 +"<row><speedTrap>16</speedTrap><driver>Fittipaldi</driver><speed>79.37</speed></row>"
78 +"<row><speedTrap>16</speedTrap><driver>Stewart</driver><speed>85.37</speed></row>"
79 +"<row><speedTrap>17</speedTrap><driver>Hunt</driver><speed>153.87</speed></row>"
80 +"<row><speedTrap>17</speedTrap><driver>Fittipaldi</driver><speed>143.87</speed></row>"
81 +"<row><speedTrap>17</speedTrap><driver>Stewart</driver><speed>133.87</speed></row>"
82 +"<row><speedTrap>18</speedTrap><driver>Hunt</driver><speed>89.87</speed></row>"
83 +"<row><speedTrap>18</speedTrap><driver>Fittipaldi</driver><speed>95.85</speed></row>"
84 +"<row><speedTrap>18</speedTrap><driver>Stewart</driver><speed>98.85</speed></row>"
85 +"<row><speedTrap>19</speedTrap><driver>Hunt</driver><speed>169.87</speed></row>"
86 +"<row><speedTrap>19</speedTrap><driver>Stewart</driver><speed>167.87</speed></row>"
87 +"<row><speedTrap>19</speedTrap><driver>Fittipaldi</driver><speed>154.87</speed></row>"
88 +"</results>"
89 //![2]
26 query: "/results/row"
90 query: "/results/row"
27
91
28 XmlRole { name: "speedTrap"; query: "speedTrap/string()" }
92 XmlRole { name: "speedTrap"; query: "speedTrap/string()" }
29 XmlRole { name: "driver"; query: "driver/string()" }
93 XmlRole { name: "driver"; query: "driver/string()" }
30 XmlRole { name: "speed"; query: "speed/string()" }
94 XmlRole { name: "speed"; query: "speed/string()" }
31 }
95 }
96 //![2]
@@ -26,6 +26,7 Rectangle {
26 height: 360
26 height: 360
27 property int currentIndex: -1
27 property int currentIndex: -1
28
28
29 //![1]
29 ChartView {
30 ChartView {
30 id: chartView
31 id: chartView
31 title: "Driver Speeds, lap 1"
32 title: "Driver Speeds, lap 1"
@@ -33,7 +34,9 Rectangle {
33 legend.alignment: Qt.AlignTop
34 legend.alignment: Qt.AlignTop
34 animationOptions: ChartView.SeriesAnimations
35 animationOptions: ChartView.SeriesAnimations
35 }
36 }
37 //![1]
36
38
39 //![2]
37 // An example XmlListModel containing F1 legend drivers' speeds at speed traps
40 // An example XmlListModel containing F1 legend drivers' speeds at speed traps
38 SpeedsXml {
41 SpeedsXml {
39 id: speedsXml
42 id: speedsXml
@@ -43,7 +46,9 Rectangle {
43 }
46 }
44 }
47 }
45 }
48 }
49 //![2]
46
50
51 //![3]
47 // A timer to mimic refreshing the data dynamically
52 // A timer to mimic refreshing the data dynamically
48 Timer {
53 Timer {
49 id: timer
54 id: timer
@@ -79,4 +84,5 Rectangle {
79 chartView.axisY.max = 250;
84 chartView.axisY.max = 250;
80 }
85 }
81 }
86 }
87 //![3]
82 }
88 }
@@ -18,6 +18,7
18 <li><a href="demos-dynamicspline.html">Dynamic spline chart</a></li>
18 <li><a href="demos-dynamicspline.html">Dynamic spline chart</a></li>
19 <li><a href="demos-qmlchart.html">Qml Basic Charts</a></li>
19 <li><a href="demos-qmlchart.html">Qml Basic Charts</a></li>
20 <li><a href="demos-qmlweather.html">Qml Weather</a></li>
20 <li><a href="demos-qmlweather.html">Qml Weather</a></li>
21 <li><a href="demos-qmlf1legends.html">Qml F1 Legends</a></li>
21 <li><a href="demos-qmlcustommodel.html">Qml Custom Model</a></li>
22 <li><a href="demos-qmlcustommodel.html">Qml Custom Model</a></li>
22 </ul>
23 </ul>
23 </td>
24 </td>
General Comments 0
You need to be logged in to leave comments. Login now