@@ -41,19 +41,18 public: | |||||
41 | QBarSeries *series = new QBarSeries(chart); |
|
41 | QBarSeries *series = new QBarSeries(chart); | |
42 | QValueAxis *valueaxis = new QValueAxis(); |
|
42 | QValueAxis *valueaxis = new QValueAxis(); | |
43 | QBarCategoryAxis *barcategory = new QBarCategoryAxis(); |
|
43 | QBarCategoryAxis *barcategory = new QBarCategoryAxis(); | |
44 |
|
|
44 | for (int i(0); i < table.count(); i++) { | |
45 |
|
|
45 | QBarSet *set = new QBarSet("Bar set " + QString::number(i)); | |
46 |
|
|
46 | foreach (Data data, table[i]) | |
47 |
|
|
47 | *set << data.first.y(); | |
48 |
|
|
48 | series->append(set); | |
49 |
|
|
49 | } | |
50 |
|
|
50 | chart->addSeries(series); | |
51 |
|
51 | |||
52 | int count = series->barSets().first()->count(); |
|
52 | int count = series->barSets().first()->count(); | |
53 |
|
53 | |||
54 |
for(int i =0 |
|
54 | for (int i = 0; i < count; i++) | |
55 | barcategory->append(QString::number(i)); |
|
55 | barcategory->append(QString::number(i)); | |
56 | } |
|
|||
57 |
|
56 | |||
58 | chart->setAxisY(valueaxis, series); |
|
57 | chart->setAxisY(valueaxis, series); | |
59 | chart->setAxisX(barcategory, series); |
|
58 | chart->setAxisX(barcategory, series); |
@@ -41,19 +41,18 public: | |||||
41 | QHorizontalBarSeries *series = new QHorizontalBarSeries(chart); |
|
41 | QHorizontalBarSeries *series = new QHorizontalBarSeries(chart); | |
42 | QValueAxis *valueaxis = new QValueAxis(); |
|
42 | QValueAxis *valueaxis = new QValueAxis(); | |
43 | QBarCategoryAxis *barcategory = new QBarCategoryAxis(); |
|
43 | QBarCategoryAxis *barcategory = new QBarCategoryAxis(); | |
44 |
|
|
44 | for (int i(0); i < table.count(); i++) { | |
45 |
|
|
45 | QBarSet *set = new QBarSet("Bar set " + QString::number(i)); | |
46 |
|
|
46 | foreach(Data data, table[i]) | |
47 |
|
|
47 | *set << data.first.y(); | |
48 |
|
|
48 | series->append(set); | |
49 |
|
|
49 | } | |
50 |
|
|
50 | chart->addSeries(series); | |
51 |
|
51 | |||
52 | int count = series->barSets().first()->count(); |
|
52 | int count = series->barSets().first()->count(); | |
53 |
|
53 | |||
54 |
for(int i =0 |
|
54 | for (int i = 0; i < count; i++) | |
55 | barcategory->append(QString::number(i)); |
|
55 | barcategory->append(QString::number(i)); | |
56 | } |
|
|||
57 |
|
56 | |||
58 | chart->setAxisX(valueaxis, series); |
|
57 | chart->setAxisX(valueaxis, series); | |
59 | chart->setAxisY(barcategory, series); |
|
58 | chart->setAxisY(barcategory, series); |
@@ -44,9 +44,9 public: | |||||
44 | int nameIndex = 0; |
|
44 | int nameIndex = 0; | |
45 | foreach (DataList list, table) { |
|
45 | foreach (DataList list, table) { | |
46 | QLineSeries *series = new QLineSeries(chart); |
|
46 | QLineSeries *series = new QLineSeries(chart); | |
47 | foreach (Data data, list){ |
|
47 | foreach (Data data, list) { | |
48 | QPointF point = data.first; |
|
48 | QPointF point = data.first; | |
49 | series->append(1000l*60l*60l*24l*365l*30l+point.x()*1000l*60l*60l*24l*365l,point.y()); |
|
49 | series->append(1000l * 60l * 60l * 24l * 365l * 30l + point.x() * 1000l * 60l * 60l * 24l * 365l, point.y()); | |
50 | } |
|
50 | } | |
51 | series->setName(name + QString::number(nameIndex)); |
|
51 | series->setName(name + QString::number(nameIndex)); | |
52 | nameIndex++; |
|
52 | nameIndex++; |
@@ -44,9 +44,9 public: | |||||
44 | int nameIndex = 0; |
|
44 | int nameIndex = 0; | |
45 | foreach (DataList list, table) { |
|
45 | foreach (DataList list, table) { | |
46 | QLineSeries *series = new QLineSeries(chart); |
|
46 | QLineSeries *series = new QLineSeries(chart); | |
47 | foreach (Data data, list){ |
|
47 | foreach (Data data, list) { | |
48 | QPointF point = data.first; |
|
48 | QPointF point = data.first; | |
49 | series->append(point.x(),1000l*60l*60l*24l*365l*30l+point.y()*1000l*60l*60l*24l*365l); |
|
49 | series->append(point.x(), 1000l * 60l * 60l * 24l * 365l * 30l + point.y() * 1000l * 60l * 60l * 24l * 365l); | |
50 | } |
|
50 | } | |
51 | series->setName(name + QString::number(nameIndex)); |
|
51 | series->setName(name + QString::number(nameIndex)); | |
52 | nameIndex++; |
|
52 | nameIndex++; |
@@ -30,7 +30,7 public: | |||||
30 | QString subCategory() { return QString::null; } |
|
30 | QString subCategory() { return QString::null; } | |
31 |
|
31 | |||
32 | QChart *createChart(const DataTable &table) |
|
32 | QChart *createChart(const DataTable &table) | |
33 |
|
|
33 | { | |
34 | QChart *chart = new QChart(); |
|
34 | QChart *chart = new QChart(); | |
35 | chart->setTitle("Donut chart"); |
|
35 | chart->setTitle("Donut chart"); | |
36 | for (int i = 0, j = table.count(); i < table.count(); i++, j--) { |
|
36 | for (int i = 0, j = table.count(); i < table.count(); i++, j--) { |
@@ -25,16 +25,17 | |||||
25 | #include <QGraphicsSceneMouseEvent> |
|
25 | #include <QGraphicsSceneMouseEvent> | |
26 | #include <QDebug> |
|
26 | #include <QDebug> | |
27 |
|
27 | |||
28 |
Grid::Grid(int size,QGraphicsItem *parent) |
|
28 | Grid::Grid(int size, QGraphicsItem *parent) | |
29 | m_listCount(3), |
|
29 | : QGraphicsWidget(parent), | |
30 | m_valueMax(10), |
|
30 | m_listCount(3), | |
31 |
m_value |
|
31 | m_valueMax(10), | |
32 | m_size(size), |
|
32 | m_valueCount(7), | |
33 | m_dataTable(Model::generateRandomData(m_listCount, m_valueMax, m_valueCount)), |
|
33 | m_size(size), | |
34 | m_state(NoState), |
|
34 | m_dataTable(Model::generateRandomData(m_listCount, m_valueMax, m_valueCount)), | |
35 |
|
|
35 | m_state(NoState), | |
36 | m_rubberBand(new QGraphicsRectItem()), |
|
36 | m_currentState(NoState), | |
37 | m_gridLayout(new QGraphicsGridLayout()) |
|
37 | m_rubberBand(new QGraphicsRectItem()), | |
|
38 | m_gridLayout(new QGraphicsGridLayout()) | |||
38 | { |
|
39 | { | |
39 | setLayout(m_gridLayout); |
|
40 | setLayout(m_gridLayout); | |
40 | m_rubberBand->setParentItem(this); |
|
41 | m_rubberBand->setParentItem(this); | |
@@ -47,7 +48,7 Grid::~Grid() | |||||
47 |
|
48 | |||
48 | } |
|
49 | } | |
49 |
|
50 | |||
50 |
void Grid::createCharts(const QString& |
|
51 | void Grid::createCharts(const QString &category) | |
51 | { |
|
52 | { | |
52 | clear(); |
|
53 | clear(); | |
53 |
|
54 | |||
@@ -55,23 +56,18 void Grid::createCharts(const QString& category) | |||||
55 | Charts::ChartList list = Charts::chartList(); |
|
56 | Charts::ChartList list = Charts::chartList(); | |
56 |
|
57 | |||
57 | if (category.isEmpty()) { |
|
58 | if (category.isEmpty()) { | |
58 |
|
||||
59 | for (int i = 0; i < m_size * m_size; ++i) { |
|
59 | for (int i = 0; i < m_size * m_size; ++i) { | |
60 | QChart *chart = 0; |
|
60 | QChart *chart = 0; | |
61 | if (i < list.size()) { |
|
61 | if (i < list.size()) { | |
62 | chart = list.at(i)->createChart(m_dataTable); |
|
62 | chart = list.at(i)->createChart(m_dataTable); | |
63 | } |
|
63 | } else { | |
64 | else { |
|
|||
65 | chart = new QChart(); |
|
64 | chart = new QChart(); | |
66 | chart->setTitle(QObject::tr("Empty")); |
|
65 | chart->setTitle(QObject::tr("Empty")); | |
67 | } |
|
66 | } | |
68 |
|
||||
69 | m_gridLayout->addItem(chart, i / m_size, i % m_size); |
|
67 | m_gridLayout->addItem(chart, i / m_size, i % m_size); | |
70 | m_chartHash[chart] = i; |
|
68 | m_chartHash[chart] = i; | |
71 | } |
|
69 | } | |
72 | } |
|
70 | } else { | |
73 | else { |
|
|||
74 |
|
||||
75 | int j = 0; |
|
71 | int j = 0; | |
76 | for (int i = 0; i < list.size(); ++i) { |
|
72 | for (int i = 0; i < list.size(); ++i) { | |
77 | Chart *chart = list.at(i); |
|
73 | Chart *chart = list.at(i); | |
@@ -95,15 +91,14 void Grid::createCharts(const QString& category) | |||||
95 |
|
91 | |||
96 | void Grid::clear() |
|
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 | m_gridLayout->removeAt(i); |
|
95 | m_gridLayout->removeAt(i); | |
100 | } |
|
|||
101 |
|
96 | |||
102 | qDeleteAll(m_chartHash.keys()); |
|
97 | qDeleteAll(m_chartHash.keys()); | |
103 | m_chartHash.clear(); |
|
98 | m_chartHash.clear(); | |
104 | } |
|
99 | } | |
105 |
|
100 | |||
106 | QList<QChart*> Grid::charts() |
|
101 | QList<QChart *> Grid::charts() | |
107 | { |
|
102 | { | |
108 | return m_chartHash.keys(); |
|
103 | return m_chartHash.keys(); | |
109 | } |
|
104 | } | |
@@ -115,19 +110,18 void Grid::setState(State state) | |||||
115 |
|
110 | |||
116 | void Grid::setSize(int size) |
|
111 | void Grid::setSize(int size) | |
117 | { |
|
112 | { | |
118 | if(m_size !=size) |
|
113 | if (m_size != size) { | |
119 | { |
|
114 | m_size = size; | |
120 | m_size = size; |
|
115 | createCharts(m_category); | |
121 | createCharts(m_category); |
|
|||
122 | } |
|
116 | } | |
123 | } |
|
117 | } | |
124 |
|
118 | |||
125 |
void Grid::setRubberPen(const QPen& |
|
119 | void Grid::setRubberPen(const QPen &pen) | |
126 | { |
|
120 | { | |
127 | m_rubberBand->setPen(pen); |
|
121 | m_rubberBand->setPen(pen); | |
128 | } |
|
122 | } | |
129 |
|
123 | |||
130 |
void Grid::replaceChart(QChart* |
|
124 | void Grid::replaceChart(QChart *oldChart, Chart *newChart) | |
131 | { |
|
125 | { | |
132 | int index = m_chartHash[oldChart]; |
|
126 | int index = m_chartHash[oldChart]; | |
133 | //not in 4.7.2 m_baseLayout->removeItem(qchart); |
|
127 | //not in 4.7.2 m_baseLayout->removeItem(qchart); | |
@@ -152,7 +146,6 void Grid::mousePressEvent(QGraphicsSceneMouseEvent *event) | |||||
152 | m_currentState = NoState; |
|
146 | m_currentState = NoState; | |
153 |
|
147 | |||
154 | foreach (QChart *chart, charts()) { |
|
148 | foreach (QChart *chart, charts()) { | |
155 |
|
||||
156 | QRectF geometryRect = chart->geometry(); |
|
149 | QRectF geometryRect = chart->geometry(); | |
157 | QRectF plotArea = chart->plotArea(); |
|
150 | QRectF plotArea = chart->plotArea(); | |
158 | plotArea.translate(geometryRect.topLeft()); |
|
151 | plotArea.translate(geometryRect.topLeft()); | |
@@ -181,11 +174,9 void Grid::mouseMoveEvent(QGraphicsSceneMouseEvent *event) | |||||
181 | if (m_currentState != NoState) { |
|
174 | if (m_currentState != NoState) { | |
182 |
|
175 | |||
183 | foreach (QChart *chart, charts()) { |
|
176 | foreach (QChart *chart, charts()) { | |
184 |
|
||||
185 | QRectF geometryRect = chart->geometry(); |
|
177 | QRectF geometryRect = chart->geometry(); | |
186 | QRectF plotArea = chart->plotArea(); |
|
178 | QRectF plotArea = chart->plotArea(); | |
187 | plotArea.translate(geometryRect.topLeft()); |
|
179 | plotArea.translate(geometryRect.topLeft()); | |
188 |
|
||||
189 | if (plotArea.contains(m_origin)) { |
|
180 | if (plotArea.contains(m_origin)) { | |
190 | if (m_currentState == ScrollState) { |
|
181 | if (m_currentState == ScrollState) { | |
191 | QPointF delta = m_origin - event->pos(); |
|
182 | QPointF delta = m_origin - event->pos(); | |
@@ -209,11 +200,9 void Grid::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |||||
209 | m_rubberBand->setVisible(false); |
|
200 | m_rubberBand->setVisible(false); | |
210 |
|
201 | |||
211 | foreach (QChart *chart, charts()) { |
|
202 | foreach (QChart *chart, charts()) { | |
212 |
|
||||
213 | QRectF geometryRect = chart->geometry(); |
|
203 | QRectF geometryRect = chart->geometry(); | |
214 | QRectF plotArea = chart->plotArea(); |
|
204 | QRectF plotArea = chart->plotArea(); | |
215 | plotArea.translate(geometryRect.topLeft()); |
|
205 | plotArea.translate(geometryRect.topLeft()); | |
216 |
|
||||
217 | if (plotArea.contains(m_origin)) { |
|
206 | if (plotArea.contains(m_origin)) { | |
218 | QRectF rect = m_rubberBand->rect(); |
|
207 | QRectF rect = m_rubberBand->rect(); | |
219 | rect.translate(-geometryRect.topLeft()); |
|
208 | rect.translate(-geometryRect.topLeft()); | |
@@ -222,20 +211,16 void Grid::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | |||||
222 | } |
|
211 | } | |
223 | } |
|
212 | } | |
224 | } |
|
213 | } | |
225 |
|
||||
226 | m_currentState = NoState; |
|
214 | m_currentState = NoState; | |
227 | event->accept(); |
|
215 | event->accept(); | |
228 | } |
|
216 | } | |
229 |
|
217 | |||
230 | if (event->button() == Qt::RightButton) { |
|
218 | if (event->button() == Qt::RightButton) { | |
231 |
|
||||
232 | if (m_currentState == ZoomState) { |
|
219 | if (m_currentState == ZoomState) { | |
233 | foreach (QChart *chart, charts()) { |
|
220 | foreach (QChart *chart, charts()) { | |
234 |
|
||||
235 | QRectF geometryRect = chart->geometry(); |
|
221 | QRectF geometryRect = chart->geometry(); | |
236 | QRectF plotArea = chart->plotArea(); |
|
222 | QRectF plotArea = chart->plotArea(); | |
237 | plotArea.translate(geometryRect.topLeft()); |
|
223 | plotArea.translate(geometryRect.topLeft()); | |
238 |
|
||||
239 | if (plotArea.contains(m_origin)) { |
|
224 | if (plotArea.contains(m_origin)) { | |
240 | chart->zoomOut(); |
|
225 | chart->zoomOut(); | |
241 | break; |
|
226 | break; |
@@ -39,24 +39,30 class Grid : public QGraphicsWidget | |||||
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 | public: |
|
40 | public: | |
41 | enum State { NoState = 0, ZoomState, ScrollState}; |
|
41 | enum State { NoState = 0, ZoomState, ScrollState}; | |
42 | Grid(int size , QGraphicsItem *parent = 0 ); |
|
42 | ||
|
43 | Grid(int size, QGraphicsItem *parent = 0); | |||
43 | ~Grid(); |
|
44 | ~Grid(); | |
44 | QList<QChart*> charts(); |
|
45 | ||
45 | void createCharts(const QString& category = QString()); |
|
46 | QList<QChart *> charts(); | |
46 | void replaceChart(QChart* oldChart, Chart* newChart); |
|
47 | void createCharts(const QString &category = QString()); | |
|
48 | void replaceChart(QChart *oldChart, Chart *newChart); | |||
47 | void setState(State state); |
|
49 | void setState(State state); | |
48 | State state() const { return m_state; }; |
|
50 | State state() const { return m_state; }; | |
49 |
void setRubberPen(const QPen& |
|
51 | void setRubberPen(const QPen &pen); | |
50 | void setSize(int size); |
|
52 | void setSize(int size); | |
51 | int size() const {return m_size;} |
|
53 | int size() const {return m_size;} | |
52 | Q_SIGNAL |
|
54 | ||
53 | void chartSelected(QChart* chart); |
|
55 | Q_SIGNALS: | |
|
56 | void chartSelected(QChart *chart); | |||
|
57 | ||||
54 | protected: |
|
58 | protected: | |
55 | void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
59 | void mousePressEvent(QGraphicsSceneMouseEvent *event); | |
56 | void mouseMoveEvent(QGraphicsSceneMouseEvent *event); |
|
60 | void mouseMoveEvent(QGraphicsSceneMouseEvent *event); | |
57 | void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
|
61 | void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); | |
|
62 | ||||
58 | private: |
|
63 | private: | |
59 | void clear(); |
|
64 | void clear(); | |
|
65 | ||||
60 | private: |
|
66 | private: | |
61 | int m_listCount; |
|
67 | int m_listCount; | |
62 | int m_valueMax; |
|
68 | int m_valueMax; | |
@@ -68,7 +74,7 private: | |||||
68 | State m_currentState; |
|
74 | State m_currentState; | |
69 | QPointF m_origin; |
|
75 | QPointF m_origin; | |
70 | QGraphicsRectItem *m_rubberBand; |
|
76 | QGraphicsRectItem *m_rubberBand; | |
71 |
QGraphicsGridLayout* |
|
77 | QGraphicsGridLayout *m_gridLayout; | |
72 | QString m_category; |
|
78 | QString m_category; | |
73 | }; |
|
79 | }; | |
74 |
|
80 |
@@ -34,19 +34,17 QVariantHash parseArgs(QStringList args) | |||||
34 |
|
34 | |||
35 | if (args.isEmpty() || args.first().startsWith("--")) { |
|
35 | if (args.isEmpty() || args.first().startsWith("--")) { | |
36 | parameters[param] = true; |
|
36 | parameters[param] = true; | |
37 | } |
|
37 | } else { | |
38 | else { |
|
|||
39 |
|
||||
40 | QString value = args.takeFirst(); |
|
38 | QString value = args.takeFirst(); | |
41 | if (value == "true" || value == "on" || value == "enabled") { |
|
39 | if (value == "true" || value == "on" || value == "enabled") { | |
42 | parameters[param] = true; |
|
40 | parameters[param] = true; | |
43 | } |
|
41 | } else if (value == "false" || value == "off" || value == "disable") { | |
44 | else if (value == "false" || value == "off" || value == "disable") { |
|
|||
45 | parameters[param] = false; |
|
42 | parameters[param] = false; | |
46 | } |
|
43 | } else { | |
47 | else { |
|
44 | if (value.endsWith('"')) | |
48 |
|
|
45 | value.chop(1); | |
49 |
if(value.startsWith( |
|
46 | if (value.startsWith('"')) | |
|
47 | value.remove(0, 1); | |||
50 | parameters[param] = value; |
|
48 | parameters[param] = value; | |
51 | } |
|
49 | } | |
52 | } |
|
50 | } |
@@ -41,24 +41,24 | |||||
41 | #include <QMenu> |
|
41 | #include <QMenu> | |
42 | #include <QPushButton> |
|
42 | #include <QPushButton> | |
43 |
|
43 | |||
44 |
Window::Window(const QVariantHash& |
|
44 | Window::Window(const QVariantHash ¶meters, QWidget *parent) | |
45 | QMainWindow(parent), |
|
45 | : QMainWindow(parent), | |
46 | m_scene(new QGraphicsScene(this)), |
|
46 | m_scene(new QGraphicsScene(this)), | |
47 | m_view(0), |
|
47 | m_view(0), | |
48 | m_form(0), |
|
48 | m_form(0), | |
49 | m_themeComboBox(0), |
|
49 | m_themeComboBox(0), | |
50 | m_antialiasCheckBox(0), |
|
50 | m_antialiasCheckBox(0), | |
51 | m_animatedComboBox(0), |
|
51 | m_animatedComboBox(0), | |
52 | m_legendComboBox(0), |
|
52 | m_legendComboBox(0), | |
53 | m_templateComboBox(0), |
|
53 | m_templateComboBox(0), | |
54 | m_viewComboBox(0), |
|
54 | m_viewComboBox(0), | |
55 | m_openGLCheckBox(0), |
|
55 | m_openGLCheckBox(0), | |
56 | m_zoomCheckBox(0), |
|
56 | m_zoomCheckBox(0), | |
57 | m_scrollCheckBox(0), |
|
57 | m_scrollCheckBox(0), | |
58 | m_baseLayout(new QGraphicsLinearLayout()), |
|
58 | m_baseLayout(new QGraphicsLinearLayout()), | |
59 | m_menu(createMenu()), |
|
59 | m_menu(createMenu()), | |
60 | m_template(0), |
|
60 | m_template(0), | |
61 | m_grid(new Grid(1)) |
|
61 | m_grid(new Grid(1)) | |
62 | { |
|
62 | { | |
63 | createProxyWidgets(); |
|
63 | createProxyWidgets(); | |
64 | // create layout |
|
64 | // create layout | |
@@ -121,7 +121,7 void Window::connectSignals() | |||||
121 | QObject::connect(m_animatedComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI())); |
|
121 | QObject::connect(m_animatedComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI())); | |
122 | QObject::connect(m_legendComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI())); |
|
122 | QObject::connect(m_legendComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI())); | |
123 | QObject::connect(m_templateComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI())); |
|
123 | QObject::connect(m_templateComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateUI())); | |
124 | QObject::connect(m_grid, SIGNAL(chartSelected(QChart*)),this,SLOT(handleChartSelected(QChart*))); |
|
124 | QObject::connect(m_grid, SIGNAL(chartSelected(QChart*)), this, SLOT(handleChartSelected(QChart*))); | |
125 | } |
|
125 | } | |
126 |
|
126 | |||
127 | void Window::createProxyWidgets() |
|
127 | void Window::createProxyWidgets() | |
@@ -212,7 +212,7 QComboBox *Window::createTempleteBox() | |||||
212 | return templateComboBox; |
|
212 | return templateComboBox; | |
213 | } |
|
213 | } | |
214 |
|
214 | |||
215 |
void Window::initializeFromParamaters(const QVariantHash& |
|
215 | void Window::initializeFromParamaters(const QVariantHash ¶meters) | |
216 | { |
|
216 | { | |
217 | if (parameters.contains("template")) { |
|
217 | if (parameters.contains("template")) { | |
218 | QString t = parameters["template"].toString(); |
|
218 | QString t = parameters["template"].toString(); | |
@@ -255,15 +255,14 void Window::initializeFromParamaters(const QVariantHash& parameters) | |||||
255 | } |
|
255 | } | |
256 | } |
|
256 | } | |
257 | if (parameters.contains("view")) { |
|
257 | if (parameters.contains("view")) { | |
258 |
|
|
258 | int t = parameters["view"].toInt(); | |
259 |
|
|
259 | for (int i = 0; i < m_viewComboBox->count(); ++i) { | |
260 |
|
|
260 | if (m_viewComboBox->itemData(i).toInt() == t) { | |
261 |
|
261 | m_viewComboBox->setCurrentIndex(i); | ||
262 | m_viewComboBox->setCurrentIndex(i); |
|
262 | break; | |
263 |
|
|
263 | } | |
264 |
|
|
264 | } | |
265 |
|
|
265 | } | |
266 | } |
|
|||
267 | } |
|
266 | } | |
268 |
|
267 | |||
269 | void Window::updateUI() |
|
268 | void Window::updateUI() | |
@@ -322,7 +321,7 void Window::checkAnimationOptions() | |||||
322 | QChart::AnimationOptions options( |
|
321 | QChart::AnimationOptions options( | |
323 | m_animatedComboBox->itemData(m_animatedComboBox->currentIndex()).toInt()); |
|
322 | m_animatedComboBox->itemData(m_animatedComboBox->currentIndex()).toInt()); | |
324 |
|
323 | |||
325 | QList<QChart*> charts = m_grid->charts(); |
|
324 | QList<QChart *> charts = m_grid->charts(); | |
326 |
|
325 | |||
327 | if (!charts.isEmpty() && charts.at(0)->animationOptions() != options) { |
|
326 | if (!charts.isEmpty() && charts.at(0)->animationOptions() != options) { | |
328 | foreach (QChart *chart, charts) |
|
327 | foreach (QChart *chart, charts) | |
@@ -415,13 +414,14 void Window::comboBoxFocused(QComboBox *combobox) | |||||
415 |
|
414 | |||
416 | void Window::handleChartSelected(QChart *qchart) |
|
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 | QAction *chosen = m_menu->exec(QCursor::pos()); |
|
420 | QAction *chosen = m_menu->exec(QCursor::pos()); | |
421 |
|
421 | |||
422 | if (chosen) { |
|
422 | if (chosen) { | |
423 | Chart *chart = (Chart *) chosen->data().value<void *>(); |
|
423 | Chart *chart = (Chart *) chosen->data().value<void *>(); | |
424 | m_grid->replaceChart(qchart,chart); |
|
424 | m_grid->replaceChart(qchart, chart); | |
425 | updateUI(); |
|
425 | updateUI(); | |
426 | } |
|
426 | } | |
427 | } |
|
427 | } |
@@ -46,7 +46,7 class Window: public QMainWindow | |||||
46 | { |
|
46 | { | |
47 | Q_OBJECT |
|
47 | Q_OBJECT | |
48 | public: |
|
48 | public: | |
49 |
explicit Window(const QVariantHash& |
|
49 | explicit Window(const QVariantHash ¶meters, QWidget *parent = 0); | |
50 | ~Window(); |
|
50 | ~Window(); | |
51 |
|
51 | |||
52 | private Q_SLOTS: |
|
52 | private Q_SLOTS: | |
@@ -71,7 +71,7 private: | |||||
71 | inline void checkTemplate(); |
|
71 | inline void checkTemplate(); | |
72 | QMenu *createMenu(); |
|
72 | QMenu *createMenu(); | |
73 | QAction *createMenuAction(QMenu *menu, const QIcon &icon, const QString &text, const QVariant &data); |
|
73 | QAction *createMenuAction(QMenu *menu, const QIcon &icon, const QString &text, const QVariant &data); | |
74 |
void initializeFromParamaters(const QVariantHash& |
|
74 | void initializeFromParamaters(const QVariantHash ¶meters); | |
75 |
|
75 | |||
76 | private: |
|
76 | private: | |
77 | QGraphicsScene *m_scene; |
|
77 | QGraphicsScene *m_scene; | |
@@ -91,7 +91,7 private: | |||||
91 | QGraphicsLinearLayout *m_baseLayout; |
|
91 | QGraphicsLinearLayout *m_baseLayout; | |
92 | QMenu *m_menu; |
|
92 | QMenu *m_menu; | |
93 | int m_template; |
|
93 | int m_template; | |
94 |
Grid* |
|
94 | Grid *m_grid; | |
95 |
|
95 | |||
96 | friend class ComboBox; |
|
96 | friend class ComboBox; | |
97 | }; |
|
97 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now