##// END OF EJS Templates
Fix compilation issue for 4.7.2
Michal Klocek -
r1762:08ffb93e7d4b
parent child
Show More
@@ -1,67 +1,68
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #ifndef MODEL_H_
22 22 #define MODEL_H_
23 23
24 24 #include <QList>
25 25 #include <QPair>
26 26 #include <QPointF>
27 27 #include <QTime>
28 #include <stdlib.h>
28 29
29 30 typedef QPair<QPointF, QString> Data;
30 31 typedef QList<Data> DataList;
31 32 typedef QList<DataList> DataTable;
32 33
33 34
34 35 class Model
35 36 {
36 37 private:
37 38 Model(){}
38 39
39 40 public:
40 41 static DataTable generateRandomData(int listCount, int valueMax, int valueCount)
41 42 {
42 43 DataTable dataTable;
43 44
44 45 // set seed for random stuff
45 46 qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
46 47
47 48 // generate random data
48 49 for (int i(0); i < listCount; i++) {
49 50 DataList dataList;
50 51 qreal yValue(0);
51 52 for (int j(0); j < valueCount; j++) {
52 53 yValue = yValue + (qreal) (qrand() % valueMax) / (qreal) valueCount;
53 54 QPointF value(
54 55 (j + (qreal) qrand() / (qreal) RAND_MAX)
55 56 * ((qreal) valueMax / (qreal) valueCount), yValue);
56 57 QString label = "Slice " + QString::number(i) + ":" + QString::number(j);
57 58 dataList << Data(value, label);
58 59 }
59 60 dataTable << dataList;
60 61 }
61 62
62 63 return dataTable;
63 64 }
64 65
65 66 };
66 67
67 68 #endif
General Comments 0
You need to be logged in to leave comments. Login now