@@ -1,276 +1,276 | |||||
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 "customtablemodel.h" |
|
21 | #include "customtablemodel.h" | |
22 | #include <QVector> |
|
22 | #include <QVector> | |
23 | #include <QTime> |
|
23 | #include <QTime> | |
24 | #include <QRect> |
|
24 | #include <QRect> | |
25 | #include <QColor> |
|
25 | #include <QColor> | |
26 |
|
26 | |||
27 | CustomTableModel::CustomTableModel(QObject *parent) : |
|
27 | CustomTableModel::CustomTableModel(QObject *parent) : | |
28 | QAbstractTableModel(parent) |
|
28 | QAbstractTableModel(parent) | |
29 | { |
|
29 | { | |
30 | // m_points.append(QPointF(10, 50)); |
|
30 | // m_points.append(QPointF(10, 50)); | |
31 | // m_labels.append("Apples"); |
|
31 | // m_labels.append("Apples"); | |
32 | // m_points.append(QPointF(60, 70)); |
|
32 | // m_points.append(QPointF(60, 70)); | |
33 | // m_labels.append("Oranges"); |
|
33 | // m_labels.append("Oranges"); | |
34 | // m_points.append(QPointF(110, 50)); |
|
34 | // m_points.append(QPointF(110, 50)); | |
35 | // m_labels.append("Bananas"); |
|
35 | // m_labels.append("Bananas"); | |
36 | // m_points.append(QPointF(140, 40)); |
|
36 | // m_points.append(QPointF(140, 40)); | |
37 | // m_labels.append("Lemons"); |
|
37 | // m_labels.append("Lemons"); | |
38 | // m_points.append(QPointF(200, 150)); |
|
38 | // m_points.append(QPointF(200, 150)); | |
39 | // m_labels.append("Plums"); |
|
39 | // m_labels.append("Plums"); | |
40 | // m_points.append(QPointF(225, 75)); |
|
40 | // m_points.append(QPointF(225, 75)); | |
41 | // m_labels.append("Pearls"); |
|
41 | // m_labels.append("Pearls"); | |
42 |
|
42 | |||
43 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); |
|
43 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); | |
44 |
|
44 | |||
45 | // m_data |
|
45 | // m_data | |
46 | for (int i = 0; i < 6; i++) |
|
46 | for (int i = 0; i < 6; i++) | |
47 | { |
|
47 | { | |
48 | QVector<qreal>* dataVec = new QVector<qreal>(6); |
|
48 | QVector<qreal>* dataVec = new QVector<qreal>(6); | |
49 | // QVector<QColor>* colorVec = new QVector<QColor>(6); |
|
49 | // QVector<QColor>* colorVec = new QVector<QColor>(6); | |
50 | for (int k = 0; k < dataVec->size(); k++) |
|
50 | for (int k = 0; k < dataVec->size(); k++) | |
51 | { |
|
51 | { | |
52 | if (k%2 == 0) |
|
52 | if (k%2 == 0) | |
53 | dataVec->replace(k, i * 50 + qrand()%20); |
|
53 | dataVec->replace(k, i * 50 + qrand()%20); | |
54 | else |
|
54 | else | |
55 | dataVec->replace(k, qrand()%100); |
|
55 | dataVec->replace(k, qrand()%100); | |
56 | // colorVec->replace(k, QColor(Qt::white)); |
|
56 | // colorVec->replace(k, QColor(Qt::white)); | |
57 | } |
|
57 | } | |
58 | m_data.append(dataVec); |
|
58 | m_data.append(dataVec); | |
59 | m_labels.append(QString("Row: %1").arg((i + 1))); |
|
59 | m_labels.append(QString("Row: %1").arg((i + 1))); | |
60 | // m_rowsColors.append(colorVec); |
|
60 | // m_rowsColors.append(colorVec); | |
61 | } |
|
61 | } | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | int CustomTableModel::rowCount(const QModelIndex & parent) const |
|
64 | int CustomTableModel::rowCount(const QModelIndex & parent) const | |
65 | { |
|
65 | { | |
66 | Q_UNUSED(parent) |
|
66 | Q_UNUSED(parent) | |
67 | // return m_points.count(); |
|
67 | // return m_points.count(); | |
68 | return m_data.count(); |
|
68 | return m_data.count(); | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | int CustomTableModel::columnCount(const QModelIndex & parent) const |
|
71 | int CustomTableModel::columnCount(const QModelIndex & parent) const | |
72 | { |
|
72 | { | |
73 | Q_UNUSED(parent) |
|
73 | Q_UNUSED(parent) | |
74 | // return 3; |
|
74 | // return 3; | |
75 | return 6; |
|
75 | return 6; | |
76 | } |
|
76 | } | |
77 |
|
77 | |||
78 | QVariant CustomTableModel::headerData (int section, Qt::Orientation orientation, int role ) const |
|
78 | QVariant CustomTableModel::headerData (int section, Qt::Orientation orientation, int role ) const | |
79 | { |
|
79 | { | |
80 | if (role != Qt::DisplayRole) |
|
80 | if (role != Qt::DisplayRole) | |
81 | return QVariant(); |
|
81 | return QVariant(); | |
82 |
|
82 | |||
83 | if (orientation == Qt::Horizontal) |
|
83 | if (orientation == Qt::Horizontal) | |
84 | { |
|
84 | { | |
85 | switch(section) |
|
85 | switch(section) | |
86 | { |
|
86 | { | |
87 | // case 0: |
|
87 | // case 0: | |
88 | // return "x"; |
|
88 | // return "x"; | |
89 | // case 1: |
|
89 | // case 1: | |
90 | // return "y"; |
|
90 | // return "y"; | |
91 | // case 2: |
|
91 | // case 2: | |
92 | case 6: |
|
92 | case 6: | |
93 | return "Fruit"; |
|
93 | return "Fruit"; | |
94 | default: |
|
94 | default: | |
95 | if (section%2 == 0) |
|
95 | if (section%2 == 0) | |
96 | return "x"; |
|
96 | return "x"; | |
97 | else |
|
97 | else | |
98 | return "y"; |
|
98 | return "y"; | |
99 | // return "What?"; |
|
99 | // return "What?"; | |
100 | } |
|
100 | } | |
101 | } |
|
101 | } | |
102 | else |
|
102 | else | |
103 | return QString("%1").arg(section /*+ 1*/); |
|
103 | return QString("%1").arg(section /*+ 1*/); | |
104 | } |
|
104 | } | |
105 |
|
105 | |||
106 | QVariant CustomTableModel::data(const QModelIndex & index, int role) const |
|
106 | QVariant CustomTableModel::data(const QModelIndex & index, int role) const | |
107 | { |
|
107 | { | |
108 | if (role == Qt::DisplayRole) |
|
108 | if (role == Qt::DisplayRole) | |
109 | { |
|
109 | { | |
110 | switch(index.column()) |
|
110 | switch(index.column()) | |
111 | { |
|
111 | { | |
112 | // case 0: |
|
112 | // case 0: | |
113 | // return m_points[index.row()].x(); |
|
113 | // return m_points[index.row()].x(); | |
114 | // case 1: |
|
114 | // case 1: | |
115 | // return m_points[index.row()].y(); |
|
115 | // return m_points[index.row()].y(); | |
116 | // case 2: |
|
116 | // case 2: | |
117 | case 6: |
|
117 | case 6: | |
118 | return m_labels[index.row()]; |
|
118 | return m_labels[index.row()]; | |
119 | default: |
|
119 | default: | |
120 | return m_data[index.row()]->at(index.column()); |
|
120 | return m_data[index.row()]->at(index.column()); | |
121 | break; |
|
121 | break; | |
122 | } |
|
122 | } | |
123 | } |
|
123 | } | |
124 | else if (role == Qt::EditRole) |
|
124 | else if (role == Qt::EditRole) | |
125 | { |
|
125 | { | |
126 | switch(index.column()) |
|
126 | switch(index.column()) | |
127 | { |
|
127 | { | |
128 | // case 0: |
|
128 | // case 0: | |
129 | // return m_points[index.row()].x(); |
|
129 | // return m_points[index.row()].x(); | |
130 | // case 1: |
|
130 | // case 1: | |
131 | // return m_points[index.row()].y(); |
|
131 | // return m_points[index.row()].y(); | |
132 | // case 2: |
|
132 | // case 2: | |
133 | case 6: |
|
133 | case 6: | |
134 | return m_labels[index.row()]; |
|
134 | return m_labels[index.row()]; | |
135 | default: |
|
135 | default: | |
136 | return m_data[index.row()]->at(index.column()); |
|
136 | return m_data[index.row()]->at(index.column()); | |
137 | break; |
|
137 | break; | |
138 | } |
|
138 | } | |
139 | } |
|
139 | } | |
140 | else if (role == Qt::BackgroundRole) |
|
140 | else if (role == Qt::BackgroundRole) | |
141 | { |
|
141 | { | |
142 | QRect rect; |
|
142 | QRect rect; | |
143 | foreach(rect, m_mapping) |
|
143 | foreach(rect, m_mapping) | |
144 | if(rect.contains(index.column(), index.row())) |
|
144 | if(rect.contains(index.column(), index.row())) | |
145 | return QColor(m_mapping.key(rect)); |
|
145 | return QColor(m_mapping.key(rect)); | |
146 |
|
146 | |||
147 | // cell not mapped return white color |
|
147 | // cell not mapped return white color | |
148 | return QColor(Qt::white); |
|
148 | return QColor(Qt::white); | |
149 | } |
|
149 | } | |
150 | return QVariant(); |
|
150 | return QVariant(); | |
151 | } |
|
151 | } | |
152 |
|
152 | |||
153 | bool CustomTableModel::setData ( const QModelIndex & index, const QVariant & value, int role) |
|
153 | bool CustomTableModel::setData ( const QModelIndex & index, const QVariant & value, int role) | |
154 | { |
|
154 | { | |
155 | if (index.isValid() && role == Qt::EditRole) |
|
155 | if (index.isValid() && role == Qt::EditRole) | |
156 | { |
|
156 | { | |
157 | switch(index.column()) |
|
157 | switch(index.column()) | |
158 | { |
|
158 | { | |
159 | // case 0: |
|
159 | // case 0: | |
160 | // m_points[index.row()].setX(value.toDouble()); |
|
160 | // m_points[index.row()].setX(value.toDouble()); | |
161 | // break; |
|
161 | // break; | |
162 | // case 1: |
|
162 | // case 1: | |
163 | // m_points[index.row()].setY(value.toDouble()); |
|
163 | // m_points[index.row()].setY(value.toDouble()); | |
164 | // break; |
|
164 | // break; | |
165 | // case 2: |
|
165 | // case 2: | |
166 | case 6: |
|
166 | case 6: | |
167 | m_labels.replace(index.row(), value.toString()); |
|
167 | m_labels.replace(index.row(), value.toString()); | |
168 | break; |
|
168 | break; | |
169 | default: |
|
169 | default: | |
170 | m_data[index.row()]->replace(index.column(), value.toDouble()); |
|
170 | m_data[index.row()]->replace(index.column(), value.toDouble()); | |
171 | break; |
|
171 | break; | |
172 | // return false; |
|
172 | // return false; | |
173 | } |
|
173 | } | |
174 | emit dataChanged(index, index); |
|
174 | emit dataChanged(index, index); | |
175 | return true; |
|
175 | return true; | |
176 | } |
|
176 | } | |
177 | // else if (role == Qt::BackgroundRole) |
|
177 | // else if (role == Qt::BackgroundRole) | |
178 | // { |
|
178 | // { | |
179 | // m_rowsColors[index.row()]->replace(index.column(), value.value<QColor>()); |
|
179 | // m_rowsColors[index.row()]->replace(index.column(), value.value<QColor>()); | |
180 | // return true; |
|
180 | // return true; | |
181 | // } |
|
181 | // } | |
182 | return false; |
|
182 | return false; | |
183 | } |
|
183 | } | |
184 |
|
184 | |||
185 | Qt::ItemFlags CustomTableModel::flags ( const QModelIndex & index ) const |
|
185 | Qt::ItemFlags CustomTableModel::flags ( const QModelIndex & index ) const | |
186 | { |
|
186 | { | |
187 | // if (!index.isValid()) |
|
187 | // if (!index.isValid()) | |
188 | // return Qt::ItemIsEnabled; |
|
188 | // return Qt::ItemIsEnabled; | |
189 | return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; |
|
189 | return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; | |
190 | } |
|
190 | } | |
191 |
|
191 | |||
192 | bool CustomTableModel::insertRows ( int row, int count, const QModelIndex & parent) |
|
192 | bool CustomTableModel::insertRows ( int row, int count, const QModelIndex & parent) | |
193 | { |
|
193 | { | |
194 | Q_UNUSED(parent) |
|
194 | Q_UNUSED(parent) | |
195 |
|
195 | |||
196 | if (row < 0) |
|
196 | if (row < 0) | |
197 | row = 0; |
|
197 | row = 0; | |
198 | beginInsertRows(QModelIndex(), row /*dataTable.count()*/, row + count - 1); |
|
198 | beginInsertRows(QModelIndex(), row /*dataTable.count()*/, row + count - 1); | |
199 | for (int i = row; i < row + count; i++) |
|
199 | for (int i = row; i < row + count; i++) | |
200 | { |
|
200 | { | |
201 | // m_points.insert(row, QPointF(10,20)); |
|
201 | // m_points.insert(row, QPointF(10,20)); | |
202 | QVector<qreal>* dataVec = new QVector<qreal>(6); |
|
202 | QVector<qreal>* dataVec = new QVector<qreal>(6); | |
203 | QVector<QColor>* colorVec = new QVector<QColor>(6); |
|
203 | QVector<QColor>* colorVec = new QVector<QColor>(6); | |
204 | for (int k = 0; k < dataVec->size(); k++) |
|
204 | for (int k = 0; k < dataVec->size(); k++) | |
205 | { |
|
205 | { | |
206 | if (k%2 == 0) |
|
206 | if (k%2 == 0) | |
207 | // dataVec->replace(k, i * 50 + qrand()%20); |
|
207 | // dataVec->replace(k, i * 50 + qrand()%20); | |
208 | { |
|
208 | { | |
209 | int difference = 0; |
|
209 | int difference = 0; | |
210 | if (i < m_data.size()) |
|
210 | if (i < m_data.size()) | |
211 | { |
|
211 | { | |
212 | if (i - 1 >= 0) |
|
212 | if (i - 1 >= 0) | |
213 | { |
|
213 | { | |
214 | if (row > 0) |
|
214 | if (row > 0) | |
215 | difference = (int)((qAbs(m_data[i]->at(k) - m_data[row - 1]->at(k)))/count); |
|
215 | difference = (int)((qAbs(m_data[i]->at(k) - m_data[row - 1]->at(k)))/count); | |
216 | else |
|
216 | else | |
217 | difference = (int)((qAbs(m_data[i]->at(k)/count))); |
|
217 | difference = (int)((qAbs(m_data[i]->at(k)/count))); | |
218 | dataVec->replace(k, m_data[i - 1]->at(k) + qrand()%qMax(1, difference)); |
|
218 | dataVec->replace(k, m_data[i - 1]->at(k) + qrand()%qMax(1, difference)); | |
219 | } |
|
219 | } | |
220 | else |
|
220 | else | |
221 | dataVec->replace(k, qrand()%40 + 10); |
|
221 | dataVec->replace(k, qrand()%40 + 10); | |
222 | } |
|
222 | } | |
223 | else |
|
223 | else | |
224 | { |
|
224 | { | |
225 | if (i - 1 >= 0) |
|
225 | if (i - 1 >= 0) | |
226 | { |
|
226 | { | |
227 | dataVec->replace(k, m_data[i - 1]->at(k) + qrand()%40 + 10); |
|
227 | dataVec->replace(k, m_data[i - 1]->at(k) + qrand()%40 + 10); | |
228 | } |
|
228 | } | |
229 | else |
|
229 | else | |
230 | { |
|
230 | { | |
231 | dataVec->replace(k, qrand()%40 + 10); |
|
231 | dataVec->replace(k, qrand()%40 + 10); | |
232 | } |
|
232 | } | |
233 | } |
|
233 | } | |
234 | } |
|
234 | } | |
235 | else |
|
235 | else | |
236 | dataVec->replace(k, qrand()%100); |
|
236 | dataVec->replace(k, qrand()%100); | |
237 | colorVec->replace(k, QColor(Qt::white)); |
|
237 | colorVec->replace(k, QColor(Qt::white)); | |
238 | } |
|
238 | } | |
239 | m_data.insert(i, dataVec); |
|
239 | m_data.insert(i, dataVec); | |
240 | m_labels.insert(i,(QString("Row: %1").arg(i + 1))); |
|
240 | m_labels.insert(i,(QString("Row: %1").arg(i + 1))); | |
241 | // m_rowsColors.insert(i, colorVec); |
|
241 | // m_rowsColors.insert(i, colorVec); | |
242 | } |
|
242 | } | |
243 | endInsertRows(); |
|
243 | endInsertRows(); | |
244 | return true; |
|
244 | return true; | |
245 | } |
|
245 | } | |
246 |
|
246 | |||
247 | bool CustomTableModel::removeRows ( int row, int count, const QModelIndex & parent) |
|
247 | bool CustomTableModel::removeRows ( int row, int count, const QModelIndex & parent) | |
248 | { |
|
248 | { | |
249 | if (row > this->rowCount() - 1) |
|
249 | if (row > this->rowCount() - 1) | |
250 | return false; |
|
250 | return false; | |
251 | if (row < 0) |
|
251 | if (row < 0) | |
252 | row = 0; |
|
252 | row = 0; | |
253 | if (row + count > rowCount()) |
|
253 | if (row + count > rowCount()) | |
254 | return false; |
|
254 | return false; | |
255 | beginRemoveRows(parent, row, row + count - 1); |
|
255 | beginRemoveRows(parent, row, row + count - 1); | |
256 | for (int i = row; i < row + count; i++) |
|
256 | for (int i = row; i < row + count; i++) | |
257 | { |
|
257 | { | |
258 | // m_points.removeAt(row); |
|
258 | // m_points.removeAt(row); | |
259 | QVector<qreal>* item = m_data.at(row); |
|
259 | QVector<qreal>* item = m_data.at(row); | |
260 | m_data.removeAt(row); |
|
260 | m_data.removeAt(row); | |
261 | delete item; |
|
261 | delete item; | |
262 | m_labels.removeAt(row); |
|
262 | m_labels.removeAt(row); | |
263 | } |
|
263 | } | |
264 | endRemoveRows(); |
|
264 | endRemoveRows(); | |
265 | return true; |
|
265 | return true; | |
266 | } |
|
266 | } | |
267 |
|
267 | |||
268 | void CustomTableModel::addMapping(QString color, QRect area) |
|
268 | void CustomTableModel::addMapping(QString color, QRect area) | |
269 | { |
|
269 | { | |
270 | m_mapping.insert(color, area); |
|
270 | m_mapping.insertMulti(color, area); | |
271 | } |
|
271 | } | |
272 |
|
272 | |||
273 | void CustomTableModel::addMapping(QString color, int left, int top, int right, int bottom) |
|
273 | void CustomTableModel::addMapping(QString color, int left, int top, int right, int bottom) | |
274 | { |
|
274 | { | |
275 | addMapping(color, QRect(QPoint(left, top), QPoint(right, bottom))); |
|
275 | addMapping(color, QRect(QPoint(left, top), QPoint(right, bottom))); | |
276 | } |
|
276 | } |
@@ -1,306 +1,310 | |||||
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 "tablewidget.h" |
|
21 | #include "tablewidget.h" | |
22 | #include <QGridLayout> |
|
22 | #include <QGridLayout> | |
23 | #include <QTableView> |
|
23 | #include <QTableView> | |
24 | #include <QStyledItemDelegate> |
|
24 | #include <QStyledItemDelegate> | |
25 | #include <QLineSeries> |
|
25 | #include <QLineSeries> | |
26 | #include <QSplineSeries> |
|
26 | #include <QSplineSeries> | |
27 | #include <QScatterSeries> |
|
27 | #include <QScatterSeries> | |
28 | #include "customtablemodel.h" |
|
28 | #include "customtablemodel.h" | |
29 | #include <QPieSeries> |
|
29 | #include <QPieSeries> | |
30 | #include <QPieSlice> |
|
30 | #include <QPieSlice> | |
31 | #include <QAreaSeries> |
|
31 | #include <QAreaSeries> | |
32 | #include <QBarSeries> |
|
32 | #include <QBarSeries> | |
33 | #include <QBarSet> |
|
33 | #include <QBarSet> | |
34 | #include <QPushButton> |
|
34 | #include <QPushButton> | |
35 | #include <QRadioButton> |
|
35 | #include <QRadioButton> | |
36 | #include <QSpinBox> |
|
36 | #include <QSpinBox> | |
37 | #include <QTime> |
|
37 | #include <QTime> | |
38 |
|
38 | |||
39 | TableWidget::TableWidget(QWidget *parent) |
|
39 | TableWidget::TableWidget(QWidget *parent) | |
40 | : QWidget(parent) |
|
40 | : QWidget(parent) | |
41 | { |
|
41 | { | |
42 | setGeometry(100, 100, 1000, 600); |
|
42 | setGeometry(100, 100, 1000, 600); | |
43 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); |
|
43 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); | |
44 | // create simple model for storing data |
|
44 | // create simple model for storing data | |
45 | // user's table data model |
|
45 | // user's table data model | |
46 | m_model = new CustomTableModel; |
|
46 | m_model = new CustomTableModel; | |
47 | m_tableView = new QTableView; |
|
47 | m_tableView = new QTableView; | |
48 | m_tableView->setModel(m_model); |
|
48 | m_tableView->setModel(m_model); | |
49 |
m_tableView->setMinimumHeight( |
|
49 | m_tableView->setMinimumHeight(300); | |
50 | // tableView->setMinimumSize(340, 480); |
|
50 | // tableView->setMinimumSize(340, 480); | |
51 | // tableView->setItemDelegate(new QStyledItemDelegate); |
|
51 | // tableView->setItemDelegate(new QStyledItemDelegate); | |
52 | m_chart = new QChart; |
|
52 | m_chart = new QChart; | |
53 | m_chartView = new QChartView(m_chart); |
|
53 | m_chartView = new QChartView(m_chart); | |
54 | m_chartView->setRenderHint(QPainter::Antialiasing); |
|
54 | m_chartView->setRenderHint(QPainter::Antialiasing); | |
55 | m_chartView->setMinimumSize(640, 480); |
|
55 | m_chartView->setMinimumSize(640, 480); | |
56 |
|
56 | |||
57 | // add, remove data buttons |
|
57 | // add, remove data buttons | |
58 | QPushButton* addRowAboveButton = new QPushButton("Add row above"); |
|
58 | QPushButton* addRowAboveButton = new QPushButton("Add row above"); | |
59 | connect(addRowAboveButton, SIGNAL(clicked()), this, SLOT(addRowAbove())); |
|
59 | connect(addRowAboveButton, SIGNAL(clicked()), this, SLOT(addRowAbove())); | |
60 |
|
60 | |||
61 | QPushButton* addRowBelowButton = new QPushButton("Add row below"); |
|
61 | QPushButton* addRowBelowButton = new QPushButton("Add row below"); | |
62 | connect(addRowBelowButton, SIGNAL(clicked()), this, SLOT(addRowBelow())); |
|
62 | connect(addRowBelowButton, SIGNAL(clicked()), this, SLOT(addRowBelow())); | |
63 |
|
63 | |||
64 | QPushButton* removeRowButton = new QPushButton("Remove row"); |
|
64 | QPushButton* removeRowButton = new QPushButton("Remove row"); | |
65 | connect(removeRowButton, SIGNAL(clicked()), this, SLOT(removeRow())); |
|
65 | connect(removeRowButton, SIGNAL(clicked()), this, SLOT(removeRow())); | |
66 |
|
66 | |||
67 | m_linesCountSpinBox = new QSpinBox; |
|
67 | m_linesCountSpinBox = new QSpinBox; | |
68 | m_linesCountSpinBox->setRange(1, 10); |
|
68 | m_linesCountSpinBox->setRange(1, 10); | |
69 | m_linesCountSpinBox->setValue(1); |
|
69 | m_linesCountSpinBox->setValue(1); | |
70 |
|
70 | |||
71 | // buttons layout |
|
71 | // buttons layout | |
72 | QVBoxLayout* buttonsLayout = new QVBoxLayout; |
|
72 | QVBoxLayout* buttonsLayout = new QVBoxLayout; | |
73 | buttonsLayout->addWidget(m_linesCountSpinBox); |
|
73 | buttonsLayout->addWidget(m_linesCountSpinBox); | |
74 | buttonsLayout->addWidget(addRowAboveButton); |
|
74 | buttonsLayout->addWidget(addRowAboveButton); | |
75 | buttonsLayout->addWidget(addRowBelowButton); |
|
75 | buttonsLayout->addWidget(addRowBelowButton); | |
76 | buttonsLayout->addWidget(removeRowButton); |
|
76 | buttonsLayout->addWidget(removeRowButton); | |
77 | buttonsLayout->addStretch(); |
|
77 | buttonsLayout->addStretch(); | |
78 |
|
78 | |||
79 | // chart type radio buttons |
|
79 | // chart type radio buttons | |
80 | m_lineRadioButton = new QRadioButton("Line"); |
|
80 | m_lineRadioButton = new QRadioButton("Line"); | |
81 | m_splineRadioButton = new QRadioButton("Spline"); |
|
81 | m_splineRadioButton = new QRadioButton("Spline"); | |
82 | m_scatterRadioButton = new QRadioButton("Scatter"); |
|
82 | m_scatterRadioButton = new QRadioButton("Scatter"); | |
83 | m_pieRadioButton = new QRadioButton("Pie"); |
|
83 | m_pieRadioButton = new QRadioButton("Pie"); | |
84 | m_areaRadioButton = new QRadioButton("Area"); |
|
84 | m_areaRadioButton = new QRadioButton("Area"); | |
85 | m_barRadioButton = new QRadioButton("Bar"); |
|
85 | m_barRadioButton = new QRadioButton("Bar"); | |
86 |
|
86 | |||
87 | connect(m_lineRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); |
|
87 | connect(m_lineRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); | |
88 | connect(m_splineRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); |
|
88 | connect(m_splineRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); | |
89 | connect(m_scatterRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); |
|
89 | connect(m_scatterRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); | |
90 | connect(m_pieRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); |
|
90 | connect(m_pieRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); | |
91 | connect(m_areaRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); |
|
91 | connect(m_areaRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); | |
92 | connect(m_barRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); |
|
92 | connect(m_barRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType())); | |
93 | m_lineRadioButton->setChecked(true); |
|
93 | m_lineRadioButton->setChecked(true); | |
94 |
|
94 | |||
95 | // radio buttons layout |
|
95 | // radio buttons layout | |
96 | QVBoxLayout* radioLayout = new QVBoxLayout; |
|
96 | QVBoxLayout* radioLayout = new QVBoxLayout; | |
97 | radioLayout->addWidget(m_lineRadioButton); |
|
97 | radioLayout->addWidget(m_lineRadioButton); | |
98 | radioLayout->addWidget(m_splineRadioButton); |
|
98 | radioLayout->addWidget(m_splineRadioButton); | |
99 | radioLayout->addWidget(m_scatterRadioButton); |
|
99 | radioLayout->addWidget(m_scatterRadioButton); | |
100 | radioLayout->addWidget(m_pieRadioButton); |
|
100 | radioLayout->addWidget(m_pieRadioButton); | |
101 | radioLayout->addWidget(m_areaRadioButton); |
|
101 | radioLayout->addWidget(m_areaRadioButton); | |
102 | radioLayout->addWidget(m_barRadioButton); |
|
102 | radioLayout->addWidget(m_barRadioButton); | |
103 | radioLayout->addStretch(); |
|
103 | radioLayout->addStretch(); | |
104 |
|
104 | |||
105 | // create main layout |
|
105 | // create main layout | |
106 | QGridLayout* mainLayout = new QGridLayout; |
|
106 | QGridLayout* mainLayout = new QGridLayout; | |
107 | mainLayout->addLayout(buttonsLayout, 1, 1); |
|
107 | mainLayout->addLayout(buttonsLayout, 1, 1); | |
108 | mainLayout->addLayout(radioLayout, 2, 1); |
|
108 | mainLayout->addLayout(radioLayout, 2, 1); | |
109 | mainLayout->addWidget(m_tableView, 1, 0); |
|
109 | mainLayout->addWidget(m_tableView, 1, 0); | |
110 | mainLayout->addWidget(m_chartView, 2, 0); |
|
110 | mainLayout->addWidget(m_chartView, 2, 0); | |
111 | setLayout(mainLayout); |
|
111 | setLayout(mainLayout); | |
112 | m_lineRadioButton->setFocus(); |
|
112 | m_lineRadioButton->setFocus(); | |
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 | void TableWidget::addRowAbove() |
|
115 | void TableWidget::addRowAbove() | |
116 | { |
|
116 | { | |
117 | m_model->insertRows(m_tableView->currentIndex().row(), m_linesCountSpinBox->value()); |
|
117 | m_model->insertRows(m_tableView->currentIndex().row(), m_linesCountSpinBox->value()); | |
118 |
|
118 | |||
119 | } |
|
119 | } | |
120 |
|
120 | |||
121 | void TableWidget::addRowBelow() |
|
121 | void TableWidget::addRowBelow() | |
122 | { |
|
122 | { | |
123 | m_model->insertRows(m_tableView->currentIndex().row() + 1, m_linesCountSpinBox->value()); |
|
123 | m_model->insertRows(m_tableView->currentIndex().row() + 1, m_linesCountSpinBox->value()); | |
124 |
|
124 | |||
125 | } |
|
125 | } | |
126 |
|
126 | |||
127 | void TableWidget::removeRow() |
|
127 | void TableWidget::removeRow() | |
128 | { |
|
128 | { | |
129 | m_model->removeRows(m_tableView->currentIndex().row(), qMin(m_model->rowCount() - m_tableView->currentIndex().row(), m_linesCountSpinBox->value())); |
|
129 | m_model->removeRows(m_tableView->currentIndex().row(), qMin(m_model->rowCount() - m_tableView->currentIndex().row(), m_linesCountSpinBox->value())); | |
130 | } |
|
130 | } | |
131 |
|
131 | |||
132 | void TableWidget::updateChartType() |
|
132 | void TableWidget::updateChartType() | |
133 | { |
|
133 | { | |
134 | m_chart->removeAllSeries(); |
|
134 | m_chart->removeAllSeries(); | |
135 | m_model->clearMapping(); |
|
135 | m_model->clearMapping(); | |
136 |
|
136 | |||
137 | QString seriesColorHex = "#000000"; |
|
137 | QString seriesColorHex = "#000000"; | |
138 | QPen pen; |
|
138 | QPen pen; | |
139 | pen.setWidth(2); |
|
139 | pen.setWidth(2); | |
140 |
|
140 | |||
141 | if (m_lineRadioButton->isChecked()) |
|
141 | if (m_lineRadioButton->isChecked()) | |
142 | { |
|
142 | { | |
143 |
|
||||
144 | m_chart->axisX()->setRange(0, 500); |
|
|||
145 | m_chart->axisY()->setRange(0, 120); |
|
|||
146 |
|
||||
147 | // series 1 |
|
143 | // series 1 | |
148 | m_series = new QLineSeries; |
|
144 | m_series = new QLineSeries; | |
149 | m_series->setModel(m_model); |
|
145 | m_series->setModel(m_model); | |
150 | m_series->setModelMapping(0,1, Qt::Vertical); |
|
146 | m_series->setModelMapping(0,1, Qt::Vertical); | |
151 | m_series->setModelMappingShift(1, 4); |
|
147 | m_series->setModelMappingShift(1, 4); | |
152 | m_chart->addSeries(m_series); |
|
148 | m_chart->addSeries(m_series); | |
153 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); |
|
149 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); | |
154 | m_model->addMapping(seriesColorHex, QRect(0, 1, 2, 4)); |
|
150 | m_model->addMapping(seriesColorHex, QRect(0, 1, 2, 4)); | |
155 |
|
151 | |||
156 | // series 2 |
|
152 | // series 2 | |
157 | m_series = new QLineSeries; |
|
153 | m_series = new QLineSeries; | |
158 | m_series->setModel(m_model); |
|
154 | m_series->setModel(m_model); | |
159 | m_series->setModelMapping(2,3, Qt::Vertical); |
|
155 | m_series->setModelMapping(2,3, Qt::Vertical); | |
160 | m_chart->addSeries(m_series); |
|
156 | m_chart->addSeries(m_series); | |
161 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); |
|
157 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); | |
162 | m_model->addMapping(seriesColorHex, QRect(2, 0, 2, 1000)); |
|
158 | m_model->addMapping(seriesColorHex, QRect(2, 0, 2, 1000)); | |
163 |
|
159 | |||
164 | // series 3 |
|
160 | // series 3 | |
165 | m_series = new QLineSeries; |
|
161 | m_series = new QLineSeries; | |
166 | m_series->setModel(m_model); |
|
162 | m_series->setModel(m_model); | |
167 | m_series->setModelMapping(4,5, Qt::Vertical); |
|
163 | m_series->setModelMapping(4,5, Qt::Vertical); | |
168 | m_series->setModelMappingShift(2, 0); |
|
164 | m_series->setModelMappingShift(2, 0); | |
169 | m_chart->addSeries(m_series); |
|
165 | m_chart->addSeries(m_series); | |
170 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); |
|
166 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); | |
171 | m_model->addMapping(seriesColorHex, QRect(4, 2, 2, 1000)); |
|
167 | m_model->addMapping(seriesColorHex, QRect(4, 2, 2, 1000)); | |
172 | } |
|
168 | } | |
173 | else if (m_splineRadioButton->isChecked()) |
|
169 | else if (m_splineRadioButton->isChecked()) | |
174 | { |
|
170 | { | |
175 | // series 1 |
|
171 | // series 1 | |
176 | m_series = new QSplineSeries; |
|
172 | m_series = new QSplineSeries; | |
177 | m_series->setModel(m_model); |
|
173 | m_series->setModel(m_model); | |
178 | m_series->setModelMapping(0,1, Qt::Vertical); |
|
174 | m_series->setModelMapping(0,1, Qt::Vertical); | |
179 | m_series->setModelMappingShift(1, 4); |
|
175 | m_series->setModelMappingShift(1, 4); | |
180 | // series->setModelMapping(0,1, Qt::Horizontal); |
|
176 | // series->setModelMapping(0,1, Qt::Horizontal); | |
181 | m_chart->addSeries(m_series); |
|
177 | m_chart->addSeries(m_series); | |
182 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); |
|
178 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); | |
183 | m_model->addMapping(seriesColorHex, QRect(0, 1, 2, 4)); |
|
179 | m_model->addMapping(seriesColorHex, QRect(0, 1, 2, 4)); | |
184 |
|
180 | |||
185 | // series 2 |
|
181 | // series 2 | |
186 | m_series = new QSplineSeries; |
|
182 | m_series = new QSplineSeries; | |
187 | m_series->setModel(m_model); |
|
183 | m_series->setModel(m_model); | |
188 | m_series->setModelMapping(2,3, Qt::Vertical); |
|
184 | m_series->setModelMapping(2,3, Qt::Vertical); | |
189 | m_series->setModelMappingShift(0, 0); |
|
185 | m_series->setModelMappingShift(0, 0); | |
190 | // series->setModelMapping(2,3, Qt::Horizontal); |
|
186 | // series->setModelMapping(2,3, Qt::Horizontal); | |
191 | m_chart->addSeries(m_series); |
|
187 | m_chart->addSeries(m_series); | |
192 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); |
|
188 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); | |
193 | m_model->addMapping(seriesColorHex, QRect(2, 0, 2, 1000)); |
|
189 | m_model->addMapping(seriesColorHex, QRect(2, 0, 2, 1000)); | |
194 |
|
190 | |||
195 | // series 3 |
|
191 | // series 3 | |
196 | m_series = new QSplineSeries; |
|
192 | m_series = new QSplineSeries; | |
197 | m_series->setModel(m_model); |
|
193 | m_series->setModel(m_model); | |
198 | m_series->setModelMapping(4,5, Qt::Vertical); |
|
194 | m_series->setModelMapping(4,5, Qt::Vertical); | |
199 | m_series->setModelMappingShift(2, 0); |
|
195 | m_series->setModelMappingShift(2, 0); | |
200 | // series->setModelMapping(4,5, Qt::Horizontal); |
|
196 | // series->setModelMapping(4,5, Qt::Horizontal); | |
201 | m_chart->addSeries(m_series); |
|
197 | m_chart->addSeries(m_series); | |
202 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); |
|
198 | seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper(); | |
203 | m_model->addMapping(seriesColorHex, QRect(4, 2, 2, 1000)); |
|
199 | m_model->addMapping(seriesColorHex, QRect(4, 2, 2, 1000)); | |
204 | } |
|
200 | } | |
205 | else if (m_scatterRadioButton->isChecked()) |
|
201 | else if (m_scatterRadioButton->isChecked()) | |
206 | { |
|
202 | { | |
207 | // series 1 |
|
203 | // series 1 | |
208 | m_series = new QScatterSeries; |
|
204 | m_series = new QScatterSeries; | |
209 | m_series->setModel(m_model); |
|
205 | m_series->setModel(m_model); | |
210 | m_series->setModelMapping(0,1, Qt::Vertical); |
|
206 | m_series->setModelMapping(0,1, Qt::Vertical); | |
211 | m_series->setModelMappingShift(2, 0); |
|
207 | m_series->setModelMappingShift(2, 0); | |
212 | // series->setModelMapping(0,1, Qt::Horizontal); |
|
208 | // series->setModelMapping(0,1, Qt::Horizontal); | |
213 | m_chart->addSeries(m_series); |
|
209 | m_chart->addSeries(m_series); | |
214 |
|
210 | |||
215 | seriesColorHex = "#" + QString::number(m_series->brush().color().rgb(), 16).right(6).toUpper(); |
|
211 | seriesColorHex = "#" + QString::number(m_series->brush().color().rgb(), 16).right(6).toUpper(); | |
216 | m_model->addMapping(seriesColorHex, QRect(0, 2, 2, 1000)); |
|
212 | m_model->addMapping(seriesColorHex, QRect(0, 2, 2, 1000)); | |
217 |
|
213 | |||
218 | // series 2 |
|
214 | // series 2 | |
219 | m_series = new QScatterSeries; |
|
215 | m_series = new QScatterSeries; | |
220 | m_series->setModel(m_model); |
|
216 | m_series->setModel(m_model); | |
221 | m_series->setModelMapping(2,3, Qt::Vertical); |
|
217 | m_series->setModelMapping(2,3, Qt::Vertical); | |
222 | m_series->setModelMappingShift(1, 6); |
|
218 | m_series->setModelMappingShift(1, 6); | |
223 | // series->setModelMapping(2,3, Qt::Horizontal); |
|
219 | // series->setModelMapping(2,3, Qt::Horizontal); | |
224 | m_chart->addSeries(m_series); |
|
220 | m_chart->addSeries(m_series); | |
225 |
|
221 | |||
226 | seriesColorHex = "#" + QString::number(m_series->brush().color().rgb(), 16).right(6).toUpper(); |
|
222 | seriesColorHex = "#" + QString::number(m_series->brush().color().rgb(), 16).right(6).toUpper(); | |
227 | m_model->addMapping(seriesColorHex, QRect(2, 1, 2, 6)); |
|
223 | m_model->addMapping(seriesColorHex, QRect(2, 1, 2, 6)); | |
228 |
|
224 | |||
229 | // series 3 |
|
225 | // series 3 | |
230 | m_series = new QScatterSeries; |
|
226 | m_series = new QScatterSeries; | |
231 | m_series->setModel(m_model); |
|
227 | m_series->setModel(m_model); | |
232 | m_series->setModelMapping(4,5, Qt::Vertical); |
|
228 | m_series->setModelMapping(4,5, Qt::Vertical); | |
233 | // series->setModelMapping(4,5, Qt::Horizontal); |
|
229 | // series->setModelMapping(4,5, Qt::Horizontal); | |
234 | m_chart->addSeries(m_series); |
|
230 | m_chart->addSeries(m_series); | |
235 | seriesColorHex = "#" + QString::number(m_series->brush().color().rgb(), 16).right(6).toUpper(); |
|
231 | seriesColorHex = "#" + QString::number(m_series->brush().color().rgb(), 16).right(6).toUpper(); | |
236 | m_model->addMapping(seriesColorHex, QRect(4, 0, 2, 1000)); |
|
232 | m_model->addMapping(seriesColorHex, QRect(4, 0, 2, 1000)); | |
237 | } |
|
233 | } | |
238 | else if (m_pieRadioButton->isChecked()) |
|
234 | else if (m_pieRadioButton->isChecked()) | |
239 | { |
|
235 | { | |
240 | // pie 1 |
|
236 | // pie 1 | |
241 | QPieSeries* pieSeries = new QPieSeries; |
|
237 | QPieSeries* pieSeries = new QPieSeries; | |
242 | pieSeries->setModel(m_model); |
|
238 | pieSeries->setModel(m_model); | |
243 | pieSeries->setModelMapping(0,0, Qt::Vertical); |
|
239 | pieSeries->setModelMapping(0,0, Qt::Vertical); | |
244 | pieSeries->setLabelsVisible(true); |
|
240 | pieSeries->setLabelsVisible(true); | |
245 | pieSeries->setPieSize(0.4); |
|
241 | pieSeries->setPieSize(0.4); | |
246 | pieSeries->setPiePosition(0.2, 0.35); |
|
242 | pieSeries->setPiePosition(0.2, 0.35); | |
247 |
|
243 | |||
248 | m_chart->addSeries(pieSeries); |
|
244 | m_chart->addSeries(pieSeries); | |
249 | seriesColorHex = "#" + QString::number(pieSeries->slices().at(pieSeries->slices().count()/2)->brush().color().rgb(), 16).right(6).toUpper(); |
|
245 | seriesColorHex = "#" + QString::number(pieSeries->slices().at(pieSeries->slices().count()/2)->brush().color().rgb(), 16).right(6).toUpper(); | |
250 | m_model->addMapping(seriesColorHex, QRect(0, 0, 1, 1000)); |
|
246 | m_model->addMapping(seriesColorHex, QRect(0, 0, 1, 1000)); | |
251 |
|
247 | |||
252 | // pie 2 |
|
248 | // pie 2 | |
253 | pieSeries = new QPieSeries; |
|
249 | pieSeries = new QPieSeries; | |
254 | pieSeries->setModel(m_model); |
|
250 | pieSeries->setModel(m_model); | |
255 | pieSeries->setModelMapping(1,1, Qt::Vertical); |
|
251 | pieSeries->setModelMapping(1,1, Qt::Vertical); | |
256 | pieSeries->setLabelsVisible(true); |
|
252 | pieSeries->setLabelsVisible(true); | |
257 | pieSeries->setPieSize(0.4); |
|
253 | pieSeries->setPieSize(0.4); | |
258 | pieSeries->setPiePosition(0.8, 0.35); |
|
254 | pieSeries->setPiePosition(0.8, 0.35); | |
259 | m_chart->addSeries(pieSeries); |
|
255 | m_chart->addSeries(pieSeries); | |
260 | seriesColorHex = "#" + QString::number(pieSeries->slices().at(pieSeries->slices().count()/2)->brush().color().rgb(), 16).right(6).toUpper(); |
|
256 | seriesColorHex = "#" + QString::number(pieSeries->slices().at(pieSeries->slices().count()/2)->brush().color().rgb(), 16).right(6).toUpper(); | |
261 | m_model->addMapping(seriesColorHex, QRect(1, 0, 1, 1000)); |
|
257 | m_model->addMapping(seriesColorHex, QRect(1, 0, 1, 1000)); | |
262 |
|
258 | |||
263 | // pie 3 |
|
259 | // pie 3 | |
264 | pieSeries = new QPieSeries; |
|
260 | pieSeries = new QPieSeries; | |
265 | pieSeries->setModel(m_model); |
|
261 | pieSeries->setModel(m_model); | |
266 | pieSeries->setModelMapping(2,2, Qt::Vertical); |
|
262 | pieSeries->setModelMapping(2,2, Qt::Vertical); | |
267 | pieSeries->setLabelsVisible(true); |
|
263 | pieSeries->setLabelsVisible(true); | |
268 | pieSeries->setPieSize(0.4); |
|
264 | pieSeries->setPieSize(0.4); | |
269 | pieSeries->setPiePosition(0.5, 0.65); |
|
265 | pieSeries->setPiePosition(0.5, 0.65); | |
270 | m_chart->addSeries(pieSeries); |
|
266 | m_chart->addSeries(pieSeries); | |
271 | seriesColorHex = "#" + QString::number(pieSeries->slices().at(pieSeries->slices().count()/2)->brush().color().rgb(), 16).right(6).toUpper(); |
|
267 | seriesColorHex = "#" + QString::number(pieSeries->slices().at(pieSeries->slices().count()/2)->brush().color().rgb(), 16).right(6).toUpper(); | |
272 | m_model->addMapping(seriesColorHex, QRect(2, 0, 1, 1000)); |
|
268 | m_model->addMapping(seriesColorHex, QRect(2, 0, 1, 1000)); | |
273 | } |
|
269 | } | |
274 | else if (m_areaRadioButton->isChecked()) |
|
270 | else if (m_areaRadioButton->isChecked()) | |
275 | { |
|
271 | { | |
276 | QLineSeries* upperLineSeries = new QLineSeries; |
|
272 | QLineSeries* upperLineSeries = new QLineSeries; | |
277 | upperLineSeries->setModel(m_model); |
|
273 | upperLineSeries->setModel(m_model); | |
278 | upperLineSeries->setModelMapping(0, 1, Qt::Vertical); |
|
274 | upperLineSeries->setModelMapping(0, 1, Qt::Vertical); | |
|
275 | upperLineSeries->setModelMappingShift(1, 5); | |||
279 | QLineSeries* lowerLineSeries = new QLineSeries; |
|
276 | QLineSeries* lowerLineSeries = new QLineSeries; | |
280 | lowerLineSeries->setModel(m_model); |
|
277 | lowerLineSeries->setModel(m_model); | |
281 | lowerLineSeries->setModelMapping(2, 3, Qt::Vertical); |
|
278 | lowerLineSeries->setModelMapping(2, 3, Qt::Vertical); | |
282 | QAreaSeries* areaSeries = new QAreaSeries(upperLineSeries, lowerLineSeries); |
|
279 | QAreaSeries* areaSeries = new QAreaSeries(upperLineSeries, lowerLineSeries); | |
283 | m_chart->addSeries(areaSeries); |
|
280 | m_chart->addSeries(areaSeries); | |
|
281 | seriesColorHex = "#" + QString::number(areaSeries->brush().color().rgb(), 16).right(6).toUpper(); | |||
|
282 | m_model->addMapping(seriesColorHex, QRect(0, 1, 2, 5)); | |||
|
283 | m_model->addMapping(seriesColorHex, QRect(2, 0, 2, 1000)); | |||
284 | } |
|
284 | } | |
285 | else if (m_barRadioButton->isChecked()) |
|
285 | else if (m_barRadioButton->isChecked()) | |
286 | { |
|
286 | { | |
287 | QBarSeries* barSeries = new QBarSeries(QStringList()); |
|
287 | QBarSeries* barSeries = new QBarSeries(QStringList()); | |
288 | barSeries->setModel(m_model); |
|
288 | barSeries->setModel(m_model); | |
289 | barSeries->setModelMapping(5, 2, 4, Qt::Vertical); |
|
289 | barSeries->setModelMapping(5, 2, 4, Qt::Vertical); | |
290 | barSeries->setToolTipEnabled(true); |
|
290 | barSeries->setToolTipEnabled(true); | |
291 | m_chart->addSeries(barSeries); |
|
291 | m_chart->addSeries(barSeries); | |
292 | for (int i = 0; i < barSeries->barsetCount(); i++) { |
|
292 | for (int i = 0; i < barSeries->barsetCount(); i++) { | |
293 | seriesColorHex = "#" + QString::number(barSeries->barsetAt(i)->brush().color().rgb(), 16).right(6).toUpper(); |
|
293 | seriesColorHex = "#" + QString::number(barSeries->barsetAt(i)->brush().color().rgb(), 16).right(6).toUpper(); | |
294 | m_model->addMapping(seriesColorHex, QRect(2 + i, 0, 1, 1000)); |
|
294 | m_model->addMapping(seriesColorHex, QRect(2 + i, 0, 1, 1000)); | |
295 | } |
|
295 | } | |
296 | } |
|
296 | } | |
297 |
|
297 | |||
|
298 | ||||
|
299 | m_chart->axisX()->setRange(0, 500); | |||
|
300 | m_chart->axisY()->setRange(0, 120); | |||
|
301 | ||||
298 | // repaint table view colors |
|
302 | // repaint table view colors | |
299 | m_tableView->repaint(); |
|
303 | m_tableView->repaint(); | |
300 | m_tableView->setFocus(); |
|
304 | m_tableView->setFocus(); | |
301 | } |
|
305 | } | |
302 |
|
306 | |||
303 | TableWidget::~TableWidget() |
|
307 | TableWidget::~TableWidget() | |
304 | { |
|
308 | { | |
305 |
|
309 | |||
306 | } |
|
310 | } |
@@ -1,516 +1,511 | |||||
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 "qxyseries.h" |
|
21 | #include "qxyseries.h" | |
22 |
|
22 | |||
23 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
23 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
24 |
|
24 | |||
25 | /*! |
|
25 | /*! | |
26 | \class QXYSeries |
|
26 | \class QXYSeries | |
27 | \brief The QXYSeries class is a base class for line, spline and scatter series. |
|
27 | \brief The QXYSeries class is a base class for line, spline and scatter series. | |
28 | */ |
|
28 | */ | |
29 |
|
29 | |||
30 | /*! |
|
30 | /*! | |
31 | \fn QPen QXYSeries::pen() const |
|
31 | \fn QPen QXYSeries::pen() const | |
32 | \brief Returns pen used to draw points for series. |
|
32 | \brief Returns pen used to draw points for series. | |
33 | \sa setPen() |
|
33 | \sa setPen() | |
34 | */ |
|
34 | */ | |
35 |
|
35 | |||
36 | /*! |
|
36 | /*! | |
37 | \fn QBrush QXYSeries::brush() const |
|
37 | \fn QBrush QXYSeries::brush() const | |
38 | \brief Returns brush used to draw points for series. |
|
38 | \brief Returns brush used to draw points for series. | |
39 | \sa setBrush() |
|
39 | \sa setBrush() | |
40 | */ |
|
40 | */ | |
41 |
|
41 | |||
42 | /*! |
|
42 | /*! | |
43 | \fn void QXYSeries::clicked(const QPointF& point) |
|
43 | \fn void QXYSeries::clicked(const QPointF& point) | |
44 | \brief Signal is emitted when user clicks the \a point on chart. |
|
44 | \brief Signal is emitted when user clicks the \a point on chart. | |
45 | */ |
|
45 | */ | |
46 |
|
46 | |||
47 | /*! |
|
47 | /*! | |
48 | \fn void QXYSeries::pointReplaced(int index) |
|
48 | \fn void QXYSeries::pointReplaced(int index) | |
49 | \brief \internal \a index |
|
49 | \brief \internal \a index | |
50 | */ |
|
50 | */ | |
51 |
|
51 | |||
52 | /*! |
|
52 | /*! | |
53 | \fn void QXYSeries::pointAdded(int index) |
|
53 | \fn void QXYSeries::pointAdded(int index) | |
54 | \brief \internal \a index |
|
54 | \brief \internal \a index | |
55 | */ |
|
55 | */ | |
56 |
|
56 | |||
57 | /*! |
|
57 | /*! | |
58 | \fn void QXYSeries::pointRemoved(int index) |
|
58 | \fn void QXYSeries::pointRemoved(int index) | |
59 | \brief \internal \a index |
|
59 | \brief \internal \a index | |
60 | */ |
|
60 | */ | |
61 |
|
61 | |||
62 | /*! |
|
62 | /*! | |
63 | \fn void QXYSeries::updated() |
|
63 | \fn void QXYSeries::updated() | |
64 | \brief \internal |
|
64 | \brief \internal | |
65 | */ |
|
65 | */ | |
66 |
|
66 | |||
67 | /*! |
|
67 | /*! | |
68 | Constructs empty series object which is a child of \a parent. |
|
68 | Constructs empty series object which is a child of \a parent. | |
69 | When series object is added to QChartView or QChart instance ownerships is transfered. |
|
69 | When series object is added to QChartView or QChart instance ownerships is transfered. | |
70 | */ |
|
70 | */ | |
71 | QXYSeries::QXYSeries(QObject *parent):QSeries(parent) |
|
71 | QXYSeries::QXYSeries(QObject *parent):QSeries(parent) | |
72 | { |
|
72 | { | |
73 | m_mapX = -1; |
|
73 | m_mapX = -1; | |
74 | m_mapY = -1; |
|
74 | m_mapY = -1; | |
75 | m_mapFirst = 0; |
|
75 | m_mapFirst = 0; | |
76 | m_mapCount = 0; |
|
76 | m_mapCount = 0; | |
77 | m_mapLimited = false; |
|
77 | m_mapLimited = false; | |
78 | m_mapOrientation = Qt::Vertical; |
|
78 | m_mapOrientation = Qt::Vertical; | |
79 | // m_mapYOrientation = Qt::Vertical; |
|
79 | // m_mapYOrientation = Qt::Vertical; | |
80 | } |
|
80 | } | |
81 | /*! |
|
81 | /*! | |
82 | Destroys the object. Series added to QChartView or QChart instances are owned by those, |
|
82 | Destroys the object. Series added to QChartView or QChart instances are owned by those, | |
83 | and are deleted when mentioned object are destroyed. |
|
83 | and are deleted when mentioned object are destroyed. | |
84 | */ |
|
84 | */ | |
85 | QXYSeries::~QXYSeries() |
|
85 | QXYSeries::~QXYSeries() | |
86 | { |
|
86 | { | |
87 | } |
|
87 | } | |
88 |
|
88 | |||
89 | /*! |
|
89 | /*! | |
90 | Adds data point \a x \a y to the series. Points are connected with lines on the chart. |
|
90 | Adds data point \a x \a y to the series. Points are connected with lines on the chart. | |
91 | */ |
|
91 | */ | |
92 | void QXYSeries::append(qreal x,qreal y) |
|
92 | void QXYSeries::append(qreal x,qreal y) | |
93 | { |
|
93 | { | |
94 | Q_ASSERT(m_x.size() == m_y.size()); |
|
94 | Q_ASSERT(m_x.size() == m_y.size()); | |
95 | m_x<<x; |
|
95 | m_x<<x; | |
96 | m_y<<y; |
|
96 | m_y<<y; | |
97 | emit pointAdded(m_x.size()-1); |
|
97 | emit pointAdded(m_x.size()-1); | |
98 | } |
|
98 | } | |
99 |
|
99 | |||
100 | /*! |
|
100 | /*! | |
101 | This is an overloaded function. |
|
101 | This is an overloaded function. | |
102 | Adds data \a point to the series. Points are connected with lines on the chart. |
|
102 | Adds data \a point to the series. Points are connected with lines on the chart. | |
103 | */ |
|
103 | */ | |
104 | void QXYSeries::append(const QPointF &point) |
|
104 | void QXYSeries::append(const QPointF &point) | |
105 | { |
|
105 | { | |
106 | append(point.x(),point.y()); |
|
106 | append(point.x(),point.y()); | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | /*! |
|
109 | /*! | |
110 | This is an overloaded function. |
|
110 | This is an overloaded function. | |
111 | Adds list of data \a points to the series. Points are connected with lines on the chart. |
|
111 | Adds list of data \a points to the series. Points are connected with lines on the chart. | |
112 | */ |
|
112 | */ | |
113 | void QXYSeries::append(const QList<QPointF> points) |
|
113 | void QXYSeries::append(const QList<QPointF> points) | |
114 | { |
|
114 | { | |
115 | foreach(const QPointF& point , points) { |
|
115 | foreach(const QPointF& point , points) { | |
116 | append(point.x(),point.y()); |
|
116 | append(point.x(),point.y()); | |
117 | } |
|
117 | } | |
118 | } |
|
118 | } | |
119 |
|
119 | |||
120 | /*! |
|
120 | /*! | |
121 | Modifies \a y value for given \a x a value. |
|
121 | Modifies \a y value for given \a x a value. | |
122 | */ |
|
122 | */ | |
123 | void QXYSeries::replace(qreal x,qreal y) |
|
123 | void QXYSeries::replace(qreal x,qreal y) | |
124 | { |
|
124 | { | |
125 | int index = m_x.indexOf(x); |
|
125 | int index = m_x.indexOf(x); | |
126 | m_x[index] = x; |
|
126 | m_x[index] = x; | |
127 | m_y[index] = y; |
|
127 | m_y[index] = y; | |
128 | emit pointReplaced(index); |
|
128 | emit pointReplaced(index); | |
129 | } |
|
129 | } | |
130 |
|
130 | |||
131 | /*! |
|
131 | /*! | |
132 | This is an overloaded function. |
|
132 | This is an overloaded function. | |
133 | Replaces current y value of for given \a point x value with \a point y value. |
|
133 | Replaces current y value of for given \a point x value with \a point y value. | |
134 | */ |
|
134 | */ | |
135 | void QXYSeries::replace(const QPointF &point) |
|
135 | void QXYSeries::replace(const QPointF &point) | |
136 | { |
|
136 | { | |
137 | replace(point.x(),point.y()); |
|
137 | replace(point.x(),point.y()); | |
138 | } |
|
138 | } | |
139 |
|
139 | |||
140 | /*! |
|
140 | /*! | |
141 | Removes first \a x value and related y value. |
|
141 | Removes first \a x value and related y value. | |
142 | */ |
|
142 | */ | |
143 | void QXYSeries::remove(qreal x) |
|
143 | void QXYSeries::remove(qreal x) | |
144 | { |
|
144 | { | |
145 | int index = m_x.indexOf(x); |
|
145 | int index = m_x.indexOf(x); | |
146 |
|
146 | |||
147 | if (index == -1) return; |
|
147 | if (index == -1) return; | |
148 |
|
148 | |||
149 | m_x.remove(index); |
|
149 | m_x.remove(index); | |
150 | m_y.remove(index); |
|
150 | m_y.remove(index); | |
151 |
|
151 | |||
152 | emit pointRemoved(index); |
|
152 | emit pointRemoved(index); | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | /*! |
|
155 | /*! | |
156 | Removes current \a x and \a y value. |
|
156 | Removes current \a x and \a y value. | |
157 | */ |
|
157 | */ | |
158 | void QXYSeries::remove(qreal x,qreal y) |
|
158 | void QXYSeries::remove(qreal x,qreal y) | |
159 | { |
|
159 | { | |
160 | int index =-1; |
|
160 | int index =-1; | |
161 | do { |
|
161 | do { | |
162 | index = m_x.indexOf(x,index+1); |
|
162 | index = m_x.indexOf(x,index+1); | |
163 | } while (index !=-1 && m_y.at(index)!=y); |
|
163 | } while (index !=-1 && m_y.at(index)!=y); | |
164 |
|
164 | |||
165 | if (index==-1) return; |
|
165 | if (index==-1) return; | |
166 |
|
166 | |||
167 | m_x.remove(index); |
|
167 | m_x.remove(index); | |
168 | m_y.remove(index); |
|
168 | m_y.remove(index); | |
169 | emit pointRemoved(index); |
|
169 | emit pointRemoved(index); | |
170 | } |
|
170 | } | |
171 |
|
171 | |||
172 | /*! |
|
172 | /*! | |
173 | Removes current \a point x value. Note \a point y value is ignored. |
|
173 | Removes current \a point x value. Note \a point y value is ignored. | |
174 | */ |
|
174 | */ | |
175 | void QXYSeries::remove(const QPointF &point) |
|
175 | void QXYSeries::remove(const QPointF &point) | |
176 | { |
|
176 | { | |
177 | remove(point.x(),point.y()); |
|
177 | remove(point.x(),point.y()); | |
178 | } |
|
178 | } | |
179 |
|
179 | |||
180 | /*! |
|
180 | /*! | |
181 | Removes all data points from the series. |
|
181 | Removes all data points from the series. | |
182 | */ |
|
182 | */ | |
183 | void QXYSeries::removeAll() |
|
183 | void QXYSeries::removeAll() | |
184 | { |
|
184 | { | |
185 | m_x.clear(); |
|
185 | m_x.clear(); | |
186 | m_y.clear(); |
|
186 | m_y.clear(); | |
187 | } |
|
187 | } | |
188 |
|
188 | |||
189 | /*! |
|
189 | /*! | |
190 | \internal \a pos |
|
190 | \internal \a pos | |
191 | */ |
|
191 | */ | |
192 | qreal QXYSeries::x(int pos) const |
|
192 | qreal QXYSeries::x(int pos) const | |
193 | { |
|
193 | { | |
194 | if (m_model) { |
|
194 | if (m_model) { | |
195 | if (m_mapOrientation == Qt::Vertical) |
|
195 | if (m_mapOrientation == Qt::Vertical) | |
196 | // consecutive data is read from model's column |
|
196 | // consecutive data is read from model's column | |
197 | return m_model->data(m_model->index(pos + m_mapFirst, m_mapX), Qt::DisplayRole).toDouble(); |
|
197 | return m_model->data(m_model->index(pos + m_mapFirst, m_mapX), Qt::DisplayRole).toDouble(); | |
198 | else |
|
198 | else | |
199 | // consecutive data is read from model's row |
|
199 | // consecutive data is read from model's row | |
200 | return m_model->data(m_model->index(m_mapX, pos + m_mapFirst), Qt::DisplayRole).toDouble(); |
|
200 | return m_model->data(m_model->index(m_mapX, pos + m_mapFirst), Qt::DisplayRole).toDouble(); | |
201 | } else { |
|
201 | } else { | |
202 | // model is not specified, return the data from series' internal data store |
|
202 | // model is not specified, return the data from series' internal data store | |
203 | return m_x.at(pos); |
|
203 | return m_x.at(pos); | |
204 | } |
|
204 | } | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | /*! |
|
207 | /*! | |
208 | \internal \a pos |
|
208 | \internal \a pos | |
209 | */ |
|
209 | */ | |
210 | qreal QXYSeries::y(int pos) const |
|
210 | qreal QXYSeries::y(int pos) const | |
211 | { |
|
211 | { | |
212 | if (m_model) { |
|
212 | if (m_model) { | |
213 | if (m_mapOrientation == Qt::Vertical) |
|
213 | if (m_mapOrientation == Qt::Vertical) | |
214 | // consecutive data is read from model's column |
|
214 | // consecutive data is read from model's column | |
215 | return m_model->data(m_model->index(pos + m_mapFirst, m_mapY), Qt::DisplayRole).toDouble(); |
|
215 | return m_model->data(m_model->index(pos + m_mapFirst, m_mapY), Qt::DisplayRole).toDouble(); | |
216 | else |
|
216 | else | |
217 | // consecutive data is read from model's row |
|
217 | // consecutive data is read from model's row | |
218 | return m_model->data(m_model->index(m_mapY, pos + m_mapFirst), Qt::DisplayRole).toDouble(); |
|
218 | return m_model->data(m_model->index(m_mapY, pos + m_mapFirst), Qt::DisplayRole).toDouble(); | |
219 | } else { |
|
219 | } else { | |
220 | // model is not specified, return the data from series' internal data store |
|
220 | // model is not specified, return the data from series' internal data store | |
221 | return m_y.at(pos); |
|
221 | return m_y.at(pos); | |
222 | } |
|
222 | } | |
223 | } |
|
223 | } | |
224 |
|
224 | |||
225 | /*! |
|
225 | /*! | |
226 | Returns number of data points within series. |
|
226 | Returns number of data points within series. | |
227 | */ |
|
227 | */ | |
228 | int QXYSeries::count() const |
|
228 | int QXYSeries::count() const | |
229 | { |
|
229 | { | |
230 | Q_ASSERT(m_x.size() == m_y.size()); |
|
230 | Q_ASSERT(m_x.size() == m_y.size()); | |
231 |
|
231 | |||
232 | if (m_model) { |
|
232 | if (m_model) { | |
233 | if (m_mapOrientation == Qt::Vertical) { |
|
233 | if (m_mapOrientation == Qt::Vertical) { | |
234 | // data is in a column. Return the number of mapped items if the model's column have enough items |
|
234 | // data is in a column. Return the number of mapped items if the model's column have enough items | |
235 | // or the number of items that can be mapped |
|
235 | // or the number of items that can be mapped | |
236 | if (m_mapLimited) |
|
236 | if (m_mapLimited) | |
237 | return qMin(m_mapCount, qMax(m_model->rowCount() - m_mapFirst, 0)); |
|
237 | return qMin(m_mapCount, qMax(m_model->rowCount() - m_mapFirst, 0)); | |
238 | else |
|
238 | else | |
239 | return qMax(m_model->rowCount() - m_mapFirst, 0); |
|
239 | return qMax(m_model->rowCount() - m_mapFirst, 0); | |
240 | } else { |
|
240 | } else { | |
241 | // data is in a row. Return the number of mapped items if the model's row have enough items |
|
241 | // data is in a row. Return the number of mapped items if the model's row have enough items | |
242 | // or the number of items that can be mapped |
|
242 | // or the number of items that can be mapped | |
243 | if (m_mapLimited) |
|
243 | if (m_mapLimited) | |
244 | return qMin(m_mapCount, qMax(m_model->columnCount() - m_mapFirst, 0)); |
|
244 | return qMin(m_mapCount, qMax(m_model->columnCount() - m_mapFirst, 0)); | |
245 | else |
|
245 | else | |
246 | return qMax(m_model->columnCount() - m_mapFirst, 0); |
|
246 | return qMax(m_model->columnCount() - m_mapFirst, 0); | |
247 | } |
|
247 | } | |
248 | } |
|
248 | } | |
249 |
|
249 | |||
250 | // model is not specified, return the number of points in the series internal data store |
|
250 | // model is not specified, return the number of points in the series internal data store | |
251 | return m_x.size(); |
|
251 | return m_x.size(); | |
252 | } |
|
252 | } | |
253 |
|
253 | |||
254 | /*! |
|
254 | /*! | |
255 | Returns the data points of the series. |
|
255 | Returns the data points of the series. | |
256 | */ |
|
256 | */ | |
257 | QList<QPointF> QXYSeries::data() |
|
257 | QList<QPointF> QXYSeries::data() | |
258 | { |
|
258 | { | |
259 | QList<QPointF> data; |
|
259 | QList<QPointF> data; | |
260 | for (int i(0); i < m_x.count() && i < m_y.count(); i++) |
|
260 | for (int i(0); i < m_x.count() && i < m_y.count(); i++) | |
261 | data.append(QPointF(m_x.at(i), m_y.at(i))); |
|
261 | data.append(QPointF(m_x.at(i), m_y.at(i))); | |
262 | return data; |
|
262 | return data; | |
263 | } |
|
263 | } | |
264 |
|
264 | |||
265 |
|
265 | |||
266 | /*! |
|
266 | /*! | |
267 | Sets \a pen used for drawing points on the chart. If the pen is not defined, the |
|
267 | Sets \a pen used for drawing points on the chart. If the pen is not defined, the | |
268 | pen from chart theme is used. |
|
268 | pen from chart theme is used. | |
269 | \sa QChart::setChartTheme() |
|
269 | \sa QChart::setChartTheme() | |
270 | */ |
|
270 | */ | |
271 | void QXYSeries::setPen(const QPen &pen) |
|
271 | void QXYSeries::setPen(const QPen &pen) | |
272 | { |
|
272 | { | |
273 | if (pen != m_pen) { |
|
273 | if (pen != m_pen) { | |
274 | m_pen = pen; |
|
274 | m_pen = pen; | |
275 | emit updated(); |
|
275 | emit updated(); | |
276 | } |
|
276 | } | |
277 | } |
|
277 | } | |
278 |
|
278 | |||
279 | /*! |
|
279 | /*! | |
280 | Sets \a brush used for drawing points on the chart. If the brush is not defined, brush |
|
280 | Sets \a brush used for drawing points on the chart. If the brush is not defined, brush | |
281 | from chart theme setting is used. |
|
281 | from chart theme setting is used. | |
282 | \sa QChart::setChartTheme() |
|
282 | \sa QChart::setChartTheme() | |
283 | */ |
|
283 | */ | |
284 |
|
284 | |||
285 | void QXYSeries::setBrush(const QBrush &brush) |
|
285 | void QXYSeries::setBrush(const QBrush &brush) | |
286 | { |
|
286 | { | |
287 | if (brush != m_brush) { |
|
287 | if (brush != m_brush) { | |
288 | m_brush = brush; |
|
288 | m_brush = brush; | |
289 | emit updated(); |
|
289 | emit updated(); | |
290 | } |
|
290 | } | |
291 | } |
|
291 | } | |
292 |
|
292 | |||
293 |
|
293 | |||
294 | /*! |
|
294 | /*! | |
295 | Stream operator for adding a data \a point to the series. |
|
295 | Stream operator for adding a data \a point to the series. | |
296 | \sa append() |
|
296 | \sa append() | |
297 | */ |
|
297 | */ | |
298 |
|
298 | |||
299 | QXYSeries& QXYSeries::operator<< (const QPointF &point) |
|
299 | QXYSeries& QXYSeries::operator<< (const QPointF &point) | |
300 | { |
|
300 | { | |
301 | append(point); |
|
301 | append(point); | |
302 | return *this; |
|
302 | return *this; | |
303 | } |
|
303 | } | |
304 |
|
304 | |||
305 |
|
305 | |||
306 | /*! |
|
306 | /*! | |
307 | Stream operator for adding a list of \a points to the series. |
|
307 | Stream operator for adding a list of \a points to the series. | |
308 | \sa append() |
|
308 | \sa append() | |
309 | */ |
|
309 | */ | |
310 |
|
310 | |||
311 | QXYSeries& QXYSeries::operator<< (const QList<QPointF> points) |
|
311 | QXYSeries& QXYSeries::operator<< (const QList<QPointF> points) | |
312 | { |
|
312 | { | |
313 | append(points); |
|
313 | append(points); | |
314 | return *this; |
|
314 | return *this; | |
315 | } |
|
315 | } | |
316 |
|
316 | |||
317 |
|
317 | |||
318 | void QXYSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) |
|
318 | void QXYSeries::modelUpdated(QModelIndex topLeft, QModelIndex bottomRight) | |
319 | { |
|
319 | { | |
320 | Q_UNUSED(bottomRight) |
|
320 | Q_UNUSED(bottomRight) | |
321 |
|
321 | |||
322 | if (m_mapOrientation == Qt::Vertical) { |
|
322 | if (m_mapOrientation == Qt::Vertical) { | |
323 | if (topLeft.row() >= m_mapFirst && (!m_mapLimited || topLeft.row() < m_mapFirst + m_mapCount)) |
|
323 | if (topLeft.row() >= m_mapFirst && (!m_mapLimited || topLeft.row() < m_mapFirst + m_mapCount)) | |
324 | emit pointReplaced(topLeft.row() - m_mapFirst); |
|
324 | emit pointReplaced(topLeft.row() - m_mapFirst); | |
325 | } else { |
|
325 | } else { | |
326 | if (topLeft.column() >= m_mapFirst && (!m_mapLimited || topLeft.column() < m_mapFirst + m_mapCount)) |
|
326 | if (topLeft.column() >= m_mapFirst && (!m_mapLimited || topLeft.column() < m_mapFirst + m_mapCount)) | |
327 | emit pointReplaced(topLeft.column() - m_mapFirst); |
|
327 | emit pointReplaced(topLeft.column() - m_mapFirst); | |
328 | } |
|
328 | } | |
329 | } |
|
329 | } | |
330 |
|
330 | |||
331 | void QXYSeries::modelDataAboutToBeAdded(QModelIndex parent, int start, int end) |
|
331 | void QXYSeries::modelDataAboutToBeAdded(QModelIndex parent, int start, int end) | |
332 | { |
|
332 | { | |
333 | Q_UNUSED(parent) |
|
333 | Q_UNUSED(parent) | |
334 | // Q_UNUSED(end) |
|
334 | // Q_UNUSED(end) | |
335 |
|
335 | |||
336 | if (m_mapLimited) { |
|
336 | if (m_mapLimited) { | |
337 | if (start >= m_mapFirst + m_mapCount) { |
|
337 | if (start >= m_mapFirst + m_mapCount) { | |
338 | // the added data is below mapped area |
|
338 | // the added data is below mapped area | |
339 | // therefore it has no relevance |
|
339 | // therefore it has no relevance | |
340 | return; |
|
340 | return; | |
341 | } else { |
|
341 | } else { | |
342 | // the added data is in the mapped area or before it and update is needed |
|
342 | // the added data is in the mapped area or before it and update is needed | |
343 |
|
343 | |||
344 | // check how many mapped items there is currently (before new items are added) |
|
344 | // check how many mapped items there is currently (before new items are added) | |
345 | // if the number of items currently is equal the m_mapCount then some needs to be removed from xychartitem |
|
345 | // if the number of items currently is equal the m_mapCount then some needs to be removed from xychartitem | |
346 | // internal storage before new ones can be added |
|
346 | // internal storage before new ones can be added | |
347 |
|
347 | |||
348 | int itemsToRemove = qMin(count() - qMax(start - m_mapFirst, 0), end - start + 1); |
|
348 | int itemsToRemove = qMin(count() - qMax(start - m_mapFirst, 0), end - start + 1); | |
349 | if (m_mapCount == count()) { |
|
349 | if (m_mapCount == count()) { | |
350 | for (int i = 0; i < itemsToRemove; i++) |
|
350 | for (int i = 0; i < itemsToRemove; i++) | |
351 | emit pointRemoved(qMin(end, count()) - i); |
|
351 | emit pointRemoved(qMin(end, count()) - i); | |
352 | } |
|
352 | } | |
353 | } |
|
353 | } | |
354 | } else { |
|
354 | } else { | |
355 | // map is not limited (it includes all the items starting from m_mapFirst till the end of model) |
|
355 | // map is not limited (it includes all the items starting from m_mapFirst till the end of model) | |
356 | // nothing to do |
|
356 | // nothing to do | |
357 | // emit pointAdded(qMax(start - m_mapFirst, 0)); |
|
357 | // emit pointAdded(qMax(start - m_mapFirst, 0)); | |
358 | } |
|
358 | } | |
359 | } |
|
359 | } | |
360 |
|
360 | |||
361 | void QXYSeries::modelDataAdded(QModelIndex parent, int start, int end) |
|
361 | void QXYSeries::modelDataAdded(QModelIndex parent, int start, int end) | |
362 | { |
|
362 | { | |
363 | Q_UNUSED(parent) |
|
363 | Q_UNUSED(parent) | |
364 | // Q_UNUSED(end) |
|
364 | // Q_UNUSED(end) | |
365 |
|
365 | |||
366 | if (m_mapLimited) { |
|
366 | if (m_mapLimited) { | |
367 | if (start >= m_mapFirst + m_mapCount) { |
|
367 | if (start >= m_mapFirst + m_mapCount) { | |
368 | // the added data is below mapped area |
|
368 | // the added data is below mapped area | |
369 | // therefore it has no relevance |
|
369 | // therefore it has no relevance | |
370 | return; |
|
370 | return; | |
371 | } else { |
|
371 | } else { | |
372 | // the added data is in the mapped area or before it |
|
372 | // the added data is in the mapped area or before it | |
373 | // update needed |
|
373 | // update needed | |
374 | if (count() > 0) { |
|
374 | if (count() > 0) { | |
375 | int toBeAdded = qMin(m_mapCount - (start - m_mapFirst), end - start + 1); |
|
375 | int toBeAdded = qMin(m_mapCount - (start - m_mapFirst), end - start + 1); | |
376 | for (int i = 0; i < toBeAdded; i++) |
|
376 | for (int i = 0; i < toBeAdded; i++) | |
377 | if (start + i >= m_mapFirst) |
|
377 | if (start + i >= m_mapFirst) | |
378 | emit pointAdded(start + i); |
|
378 | emit pointAdded(start + i); | |
379 | } |
|
379 | } | |
380 | } |
|
380 | } | |
381 | } else { |
|
381 | } else { | |
382 | // map is not limited (it included all the items starting from m_mapFirst till the end of model) |
|
382 | // map is not limited (it included all the items starting from m_mapFirst till the end of model) | |
383 | for (int i = 0; i < end - start + 1; i++) |
|
383 | for (int i = 0; i < end - start + 1; i++) | |
384 | emit pointAdded(start + i); |
|
384 | emit pointAdded(start + i); | |
385 | } |
|
385 | } | |
386 | } |
|
386 | } | |
387 |
|
387 | |||
388 | void QXYSeries::modelDataAboutToBeRemoved(QModelIndex parent, int start, int end) |
|
388 | void QXYSeries::modelDataAboutToBeRemoved(QModelIndex parent, int start, int end) | |
389 | { |
|
389 | { | |
390 | Q_UNUSED(parent) |
|
390 | Q_UNUSED(parent) | |
391 | // Q_UNUSED(end) |
|
391 | // Q_UNUSED(end) | |
392 |
|
392 | |||
393 | if (m_mapLimited) { |
|
393 | if (m_mapLimited) { | |
394 | if (start >= m_mapFirst + m_mapCount) { |
|
394 | if (start >= m_mapFirst + m_mapCount) { | |
395 | // the removed data is below mapped area |
|
395 | // the removed data is below mapped area | |
396 | // therefore it has no relevance |
|
396 | // therefore it has no relevance | |
397 | return; |
|
397 | return; | |
398 | } else { |
|
398 | } else { | |
399 | // the removed data is in the mapped area or before it |
|
399 | // the removed data is in the mapped area or before it | |
400 | // update needed |
|
400 | // update needed | |
401 |
|
401 | |||
402 | // check how many items need to be removed from the xychartitem storage |
|
402 | // check how many items need to be removed from the xychartitem storage | |
403 | // the number equals the number of items that are removed and that lay before |
|
403 | // the number equals the number of items that are removed and that lay before | |
404 | // or in the mapped area. Items that lay beyond the map do not count |
|
404 | // or in the mapped area. Items that lay beyond the map do not count | |
405 | // the max is the current number of items in storage (count()) |
|
405 | // the max is the current number of items in storage (count()) | |
406 | int itemsToRemove = qMin(count(), qMin(end, m_mapFirst + m_mapCount - 1) - start + 1); |
|
406 | int itemsToRemove = qMin(count(), qMin(end, m_mapFirst + m_mapCount - 1) - start + 1); | |
407 | for (int i = 0; i < itemsToRemove; i++) |
|
407 | for (int i = 0; i < itemsToRemove; i++) | |
408 | emit pointRemoved(start); |
|
408 | emit pointRemoved(start); | |
409 | } |
|
409 | } | |
410 | } else { |
|
410 | } else { | |
411 | // map is not limited (it included all the items starting from m_mapFirst till the end of model) |
|
411 | // map is not limited (it included all the items starting from m_mapFirst till the end of model) | |
412 | for (int i = 0; i < end - start + 1; i++) |
|
412 | for (int i = 0; i < end - start + 1; i++) | |
413 | emit pointRemoved(start); |
|
413 | emit pointRemoved(start); | |
414 | } |
|
414 | } | |
415 | } |
|
415 | } | |
416 |
|
416 | |||
417 | void QXYSeries::modelDataRemoved(QModelIndex parent, int start, int end) |
|
417 | void QXYSeries::modelDataRemoved(QModelIndex parent, int start, int end) | |
418 | { |
|
418 | { | |
419 | Q_UNUSED(parent) |
|
419 | Q_UNUSED(parent) | |
420 | Q_UNUSED(end) |
|
420 | Q_UNUSED(end) | |
421 |
|
421 | |||
422 | // how many items there were before data was removed |
|
422 | // how many items there were before data was removed | |
423 | // int oldCount = count() - 1; |
|
423 | // int oldCount = count() - 1; | |
424 |
|
424 | |||
425 | if (m_mapLimited) { |
|
425 | if (m_mapLimited) { | |
426 | if (start >= m_mapFirst + m_mapCount) { |
|
426 | if (start >= m_mapFirst + m_mapCount) { | |
427 | // the removed data is below mapped area |
|
427 | // the removed data is below mapped area | |
428 | // therefore it has no relevance |
|
428 | // therefore it has no relevance | |
429 | return; |
|
429 | return; | |
430 | } else { |
|
430 | } else { | |
431 | // if the current items count in the whole model is bigger than the index of the last item |
|
431 | // if the current items count in the whole model is bigger than the index of the last item | |
432 | // that was removed than it means there are some extra items available |
|
432 | // that was removed than it means there are some extra items available | |
433 |
|
433 | |||
434 | int removedItemsCount = qMin(count(), qMin(end, m_mapFirst + m_mapCount - 1) - start + 1); |
|
434 | int removedItemsCount = qMin(count(), qMin(end, m_mapFirst + m_mapCount - 1) - start + 1); | |
435 | int extraItemsAvailable = 0; |
|
435 | int extraItemsAvailable = 0; | |
436 | if (m_mapOrientation == Qt::Vertical) { |
|
436 | if (m_mapOrientation == Qt::Vertical) { | |
437 | // int temp1 = m_model->rowCount(); |
|
|||
438 | // int temp2 = (end - start + 1); |
|
|||
439 | // int temp3 = qMax(end + 1, m_mapFirst + m_mapCount); |
|
|||
440 | extraItemsAvailable = qMax(m_model->rowCount() + (end - start + 1) - qMax(end + 1, m_mapFirst + m_mapCount), 0); |
|
437 | extraItemsAvailable = qMax(m_model->rowCount() + (end - start + 1) - qMax(end + 1, m_mapFirst + m_mapCount), 0); | |
441 | } else { |
|
438 | } else { | |
442 | extraItemsAvailable = qMax(m_model->columnCount() + (end - start + 1) - qMax(end + 1, m_mapFirst + m_mapCount), 0); |
|
439 | extraItemsAvailable = qMax(m_model->columnCount() + (end - start + 1) - qMax(end + 1, m_mapFirst + m_mapCount), 0); | |
443 | } |
|
440 | } | |
444 |
|
441 | |||
445 | // if there are excess items available (below the mapped area) use them to repopulate mapped area |
|
442 | // if there are excess items available (below the mapped area) use them to repopulate mapped area | |
446 | int toBeAdded = qMin(extraItemsAvailable, removedItemsCount); |
|
443 | int toBeAdded = qMin(extraItemsAvailable, removedItemsCount); | |
447 | for (int k = 0; k < toBeAdded; k++) |
|
444 | for (int k = 0; k < toBeAdded; k++) | |
448 | emit pointAdded(m_mapFirst + m_mapCount - removedItemsCount + k); |
|
445 | emit pointAdded(m_mapFirst + m_mapCount - removedItemsCount + k); | |
449 | } |
|
446 | } | |
450 | } else { |
|
447 | } else { | |
451 | // data was removed from XYSeries interal storage. Nothing more to do |
|
448 | // data was removed from XYSeries interal storage. Nothing more to do | |
452 | } |
|
449 | } | |
453 | } |
|
450 | } | |
454 |
|
451 | |||
455 | bool QXYSeries::setModel(QAbstractItemModel *model) { |
|
452 | bool QXYSeries::setModel(QAbstractItemModel *model) { | |
456 |
|
453 | |||
457 | // disconnect signals from old model |
|
454 | // disconnect signals from old model | |
458 | if (m_model) { |
|
455 | if (m_model) { | |
459 | disconnect(m_model, 0, this, 0); |
|
456 | disconnect(m_model, 0, this, 0); | |
460 | m_mapX = -1; |
|
457 | m_mapX = -1; | |
461 | m_mapY = -1; |
|
458 | m_mapY = -1; | |
462 | m_mapFirst = 0; |
|
459 | m_mapFirst = 0; | |
463 | m_mapCount = 0; |
|
460 | m_mapCount = 0; | |
464 | m_mapLimited = false; |
|
461 | m_mapLimited = false; | |
465 | m_mapOrientation = Qt::Vertical; |
|
462 | m_mapOrientation = Qt::Vertical; | |
466 | } |
|
463 | } | |
467 |
|
464 | |||
468 | // set new model |
|
465 | // set new model | |
469 | if (model) { |
|
466 | if (model) { | |
470 | m_model = model; |
|
467 | m_model = model; | |
471 | return true; |
|
468 | return true; | |
472 | } else { |
|
469 | } else { | |
473 | m_model = 0; |
|
470 | m_model = 0; | |
474 | return false; |
|
471 | return false; | |
475 | } |
|
472 | } | |
476 | } |
|
473 | } | |
477 |
|
474 | |||
478 | void QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation) |
|
475 | void QXYSeries::setModelMapping(int modelX, int modelY, Qt::Orientation orientation) | |
479 | { |
|
476 | { | |
480 | if (m_model == 0) |
|
477 | if (m_model == 0) | |
481 | return; |
|
478 | return; | |
482 | m_mapX = modelX; |
|
479 | m_mapX = modelX; | |
483 | m_mapY = modelY; |
|
480 | m_mapY = modelY; | |
484 | m_mapFirst = 0; |
|
481 | m_mapFirst = 0; | |
485 | m_mapOrientation = orientation; |
|
482 | m_mapOrientation = orientation; | |
486 | if (m_mapOrientation == Qt::Vertical) { |
|
483 | if (m_mapOrientation == Qt::Vertical) { | |
487 | // m_mapCount = m_model->rowCount(); |
|
|||
488 | connect(m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelUpdated(QModelIndex, QModelIndex))); |
|
484 | connect(m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelUpdated(QModelIndex, QModelIndex))); | |
489 | connect(m_model,SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int)), this, SLOT(modelDataAboutToBeAdded(QModelIndex,int,int))); |
|
485 | connect(m_model,SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int)), this, SLOT(modelDataAboutToBeAdded(QModelIndex,int,int))); | |
490 | connect(m_model,SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(modelDataAdded(QModelIndex,int,int))); |
|
486 | connect(m_model,SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(modelDataAdded(QModelIndex,int,int))); | |
491 | connect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), this, SLOT(modelDataAboutToBeRemoved(QModelIndex,int,int))); |
|
487 | connect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), this, SLOT(modelDataAboutToBeRemoved(QModelIndex,int,int))); | |
492 | connect(m_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(modelDataRemoved(QModelIndex,int,int))); |
|
488 | connect(m_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(modelDataRemoved(QModelIndex,int,int))); | |
493 | } else { |
|
489 | } else { | |
494 | // m_mapCount = m_model->columnCount(); |
|
|||
495 | connect(m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelUpdated(QModelIndex, QModelIndex))); |
|
490 | connect(m_model,SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelUpdated(QModelIndex, QModelIndex))); | |
496 | connect(m_model,SIGNAL(columnsAboutToBeInserted(QModelIndex, int, int)), this, SLOT(modelDataAboutToBeAdded(QModelIndex,int,int))); |
|
491 | connect(m_model,SIGNAL(columnsAboutToBeInserted(QModelIndex, int, int)), this, SLOT(modelDataAboutToBeAdded(QModelIndex,int,int))); | |
497 | connect(m_model,SIGNAL(columnsInserted(QModelIndex, int, int)), this, SLOT(modelDataAdded(QModelIndex,int,int))); |
|
492 | connect(m_model,SIGNAL(columnsInserted(QModelIndex, int, int)), this, SLOT(modelDataAdded(QModelIndex,int,int))); | |
498 | connect(m_model, SIGNAL(columnsAboutToBeRemoved(QModelIndex, int, int)), this, SLOT(modelDataAboutToBeRemoved(QModelIndex,int,int))); |
|
493 | connect(m_model, SIGNAL(columnsAboutToBeRemoved(QModelIndex, int, int)), this, SLOT(modelDataAboutToBeRemoved(QModelIndex,int,int))); | |
499 | connect(m_model, SIGNAL(columnsRemoved(QModelIndex, int, int)), this, SLOT(modelDataRemoved(QModelIndex,int,int))); |
|
494 | connect(m_model, SIGNAL(columnsRemoved(QModelIndex, int, int)), this, SLOT(modelDataRemoved(QModelIndex,int,int))); | |
500 | } |
|
495 | } | |
501 | } |
|
496 | } | |
502 |
|
497 | |||
503 | void QXYSeries::setModelMappingShift(int first, int count) |
|
498 | void QXYSeries::setModelMappingShift(int first, int count) | |
504 | { |
|
499 | { | |
505 | m_mapFirst = first; |
|
500 | m_mapFirst = first; | |
506 | if (count == 0) { |
|
501 | if (count == 0) { | |
507 | m_mapLimited = false; |
|
502 | m_mapLimited = false; | |
508 | } else { |
|
503 | } else { | |
509 | m_mapCount = count; |
|
504 | m_mapCount = count; | |
510 | m_mapLimited = true; |
|
505 | m_mapLimited = true; | |
511 | } |
|
506 | } | |
512 | } |
|
507 | } | |
513 |
|
508 | |||
514 | #include "moc_qxyseries.cpp" |
|
509 | #include "moc_qxyseries.cpp" | |
515 |
|
510 | |||
516 | QTCOMMERCIALCHART_END_NAMESPACE |
|
511 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now