@@ -51,9 +51,8 public: | |||
|
51 | 51 | |
|
52 | 52 | int count = series->barSets().first()->count(); |
|
53 | 53 | |
|
54 |
for(int i =0 |
|
|
54 | for (int i = 0; i < count; i++) | |
|
55 | 55 | barcategory->append(QString::number(i)); |
|
56 | } | |
|
57 | 56 | |
|
58 | 57 | chart->setAxisY(valueaxis, series); |
|
59 | 58 | chart->setAxisX(barcategory, series); |
@@ -51,9 +51,8 public: | |||
|
51 | 51 | |
|
52 | 52 | int count = series->barSets().first()->count(); |
|
53 | 53 | |
|
54 |
for(int i =0 |
|
|
54 | for (int i = 0; i < count; i++) | |
|
55 | 55 | barcategory->append(QString::number(i)); |
|
56 | } | |
|
57 | 56 | |
|
58 | 57 | chart->setAxisX(valueaxis, series); |
|
59 | 58 | chart->setAxisY(barcategory, series); |
|
1 | NO CONTENT: modified file |
|
1 | NO CONTENT: modified file |
|
1 | NO CONTENT: modified file |
@@ -25,7 +25,8 | |||
|
25 | 25 | #include <QGraphicsSceneMouseEvent> |
|
26 | 26 | #include <QDebug> |
|
27 | 27 | |
|
28 |
Grid::Grid(int size,QGraphicsItem *parent) |
|
|
28 | Grid::Grid(int size, QGraphicsItem *parent) | |
|
29 | : QGraphicsWidget(parent), | |
|
29 | 30 | m_listCount(3), |
|
30 | 31 | m_valueMax(10), |
|
31 | 32 | m_valueCount(7), |
@@ -55,23 +56,18 void Grid::createCharts(const QString& category) | |||
|
55 | 56 | Charts::ChartList list = Charts::chartList(); |
|
56 | 57 | |
|
57 | 58 | if (category.isEmpty()) { |
|
58 | ||
|
59 | 59 | for (int i = 0; i < m_size * m_size; ++i) { |
|
60 | 60 | QChart *chart = 0; |
|
61 | 61 | if (i < list.size()) { |
|
62 | 62 | chart = list.at(i)->createChart(m_dataTable); |
|
63 | } | |
|
64 | else { | |
|
63 | } else { | |
|
65 | 64 | chart = new QChart(); |
|
66 | 65 | chart->setTitle(QObject::tr("Empty")); |
|
67 | 66 | } |
|
68 | ||
|
69 | 67 | m_gridLayout->addItem(chart, i / m_size, i % m_size); |
|
70 | 68 | m_chartHash[chart] = i; |
|
71 | 69 | } |
|
72 | } | |
|
73 | else { | |
|
74 | ||
|
70 | } else { | |
|
75 | 71 | int j = 0; |
|
76 | 72 | for (int i = 0; i < list.size(); ++i) { |
|
77 | 73 | Chart *chart = list.at(i); |
@@ -95,9 +91,8 void Grid::createCharts(const QString& category) | |||
|
95 | 91 | |
|
96 | 92 | void Grid::clear() |
|
97 | 93 | { |
|
98 |
for (int i = 0; i < m_gridLayout->count(); ++i) |
|
|
94 | for (int i = 0; i < m_gridLayout->count(); ++i) | |
|
99 | 95 | m_gridLayout->removeAt(i); |
|
100 | } | |
|
101 | 96 | |
|
102 | 97 | qDeleteAll(m_chartHash.keys()); |
|
103 | 98 | m_chartHash.clear(); |
@@ -115,8 +110,7 void Grid::setState(State state) | |||
|
115 | 110 | |
|
116 | 111 | void Grid::setSize(int size) |
|
117 | 112 | { |
|
118 | if(m_size !=size) | |
|
119 | { | |
|
113 | if (m_size != size) { | |
|
120 | 114 | m_size = size; |
|
121 | 115 | createCharts(m_category); |
|
122 | 116 | } |
@@ -152,7 +146,6 void Grid::mousePressEvent(QGraphicsSceneMouseEvent *event) | |||
|
152 | 146 | m_currentState = NoState; |
|
153 | 147 | |
|
154 | 148 | foreach (QChart *chart, charts()) { |
|
155 | ||
|
156 | 149 | QRectF geometryRect = chart->geometry(); |
|
157 | 150 | QRectF plotArea = chart->plotArea(); |
|
158 | 151 | plotArea.translate(geometryRect.topLeft()); |
@@ -181,11 +174,9 void Grid::mouseMoveEvent(QGraphicsSceneMouseEvent *event) | |||
|
181 | 174 | if (m_currentState != NoState) { |
|
182 | 175 | |
|
183 | 176 | foreach (QChart *chart, charts()) { |
|
184 | ||
|
185 | 177 | QRectF geometryRect = chart->geometry(); |
|
186 | 178 | QRectF plotArea = chart->plotArea(); |
|
187 | 179 | plotArea.translate(geometryRect.topLeft()); |
|
188 | ||
|
189 | 180 | if (plotArea.contains(m_origin)) { |
|
190 | 181 | if (m_currentState == ScrollState) { |
|
191 | 182 | QPointF delta = m_origin - event->pos(); |
@@ -209,11 +200,9 void Grid::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |||
|
209 | 200 | m_rubberBand->setVisible(false); |
|
210 | 201 | |
|
211 | 202 | foreach (QChart *chart, charts()) { |
|
212 | ||
|
213 | 203 | QRectF geometryRect = chart->geometry(); |
|
214 | 204 | QRectF plotArea = chart->plotArea(); |
|
215 | 205 | plotArea.translate(geometryRect.topLeft()); |
|
216 | ||
|
217 | 206 | if (plotArea.contains(m_origin)) { |
|
218 | 207 | QRectF rect = m_rubberBand->rect(); |
|
219 | 208 | rect.translate(-geometryRect.topLeft()); |
@@ -222,20 +211,16 void Grid::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |||
|
222 | 211 | } |
|
223 | 212 | } |
|
224 | 213 | } |
|
225 | ||
|
226 | 214 | m_currentState = NoState; |
|
227 | 215 | event->accept(); |
|
228 | 216 | } |
|
229 | 217 | |
|
230 | 218 | if (event->button() == Qt::RightButton) { |
|
231 | ||
|
232 | 219 | if (m_currentState == ZoomState) { |
|
233 | 220 | foreach (QChart *chart, charts()) { |
|
234 | ||
|
235 | 221 | QRectF geometryRect = chart->geometry(); |
|
236 | 222 | QRectF plotArea = chart->plotArea(); |
|
237 | 223 | plotArea.translate(geometryRect.topLeft()); |
|
238 | ||
|
239 | 224 | if (plotArea.contains(m_origin)) { |
|
240 | 225 | chart->zoomOut(); |
|
241 | 226 | break; |
@@ -39,8 +39,10 class Grid : public QGraphicsWidget | |||
|
39 | 39 | Q_OBJECT |
|
40 | 40 | public: |
|
41 | 41 | enum State { NoState = 0, ZoomState, ScrollState}; |
|
42 | ||
|
42 | 43 |
Grid(int size |
|
43 | 44 | ~Grid(); |
|
45 | ||
|
44 | 46 | QList<QChart*> charts(); |
|
45 | 47 |
void createCharts(const QString& |
|
46 | 48 |
void replaceChart(QChart* |
@@ -49,14 +51,18 public: | |||
|
49 | 51 |
void setRubberPen(const QPen& |
|
50 | 52 | void setSize(int size); |
|
51 | 53 | int size() const {return m_size;} |
|
52 | Q_SIGNAL | |
|
54 | ||
|
55 | Q_SIGNALS: | |
|
53 | 56 |
void chartSelected(QChart* |
|
57 | ||
|
54 | 58 | protected: |
|
55 | 59 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
56 | 60 | void mouseMoveEvent(QGraphicsSceneMouseEvent *event); |
|
57 | 61 | void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
|
62 | ||
|
58 | 63 | private: |
|
59 | 64 | void clear(); |
|
65 | ||
|
60 | 66 | private: |
|
61 | 67 | int m_listCount; |
|
62 | 68 | int m_valueMax; |
@@ -34,19 +34,17 QVariantHash parseArgs(QStringList args) | |||
|
34 | 34 | |
|
35 | 35 | if (args.isEmpty() || args.first().startsWith("--")) { |
|
36 | 36 | parameters[param] = true; |
|
37 | } | |
|
38 | else { | |
|
39 | ||
|
37 | } else { | |
|
40 | 38 | QString value = args.takeFirst(); |
|
41 | 39 | if (value == "true" || value == "on" || value == "enabled") { |
|
42 | 40 | parameters[param] = true; |
|
43 | } | |
|
44 | else if (value == "false" || value == "off" || value == "disable") { | |
|
41 | } else if (value == "false" || value == "off" || value == "disable") { | |
|
45 | 42 | parameters[param] = false; |
|
46 | } | |
|
47 | else { | |
|
48 |
|
|
|
49 |
if(value.startsWith( |
|
|
43 | } else { | |
|
44 | if (value.endsWith('"')) | |
|
45 | value.chop(1); | |
|
46 | if (value.startsWith('"')) | |
|
47 | value.remove(0, 1); | |
|
50 | 48 | parameters[param] = value; |
|
51 | 49 | } |
|
52 | 50 | } |
@@ -41,8 +41,8 | |||
|
41 | 41 | #include <QMenu> |
|
42 | 42 | #include <QPushButton> |
|
43 | 43 | |
|
44 |
Window::Window(const QVariantHash& |
|
|
45 | QMainWindow(parent), | |
|
44 | Window::Window(const QVariantHash ¶meters, QWidget *parent) | |
|
45 | : QMainWindow(parent), | |
|
46 | 46 | m_scene(new QGraphicsScene(this)), |
|
47 | 47 | m_view(0), |
|
48 | 48 | m_form(0), |
@@ -258,7 +258,6 void Window::initializeFromParamaters(const QVariantHash& parameters) | |||
|
258 | 258 |
|
|
259 | 259 |
|
|
260 | 260 |
|
|
261 | ||
|
262 | 261 |
|
|
263 | 262 |
|
|
264 | 263 |
|
@@ -415,7 +414,8 void Window::comboBoxFocused(QComboBox *combobox) | |||
|
415 | 414 | |
|
416 | 415 | void Window::handleChartSelected(QChart *qchart) |
|
417 | 416 | { |
|
418 |
if(m_templateComboBox->currentIndex() != 0) |
|
|
417 | if (m_templateComboBox->currentIndex() != 0) | |
|
418 | return; | |
|
419 | 419 | |
|
420 | 420 | QAction *chosen = m_menu->exec(QCursor::pos()); |
|
421 | 421 |
|
1 | NO CONTENT: modified file |
General Comments 0
You need to be logged in to leave comments.
Login now