##// END OF EJS Templates
The test app now preserves series type selection
Tero Ahola -
r26:aa0e09b6abc0
parent child
Show More
@@ -6,7 +6,7
6 #include <QLabel>
6 #include <QLabel>
7 #include <QDebug>
7 #include <QDebug>
8
8
9 DataSerieDialog::DataSerieDialog(QWidget *parent) :
9 DataSerieDialog::DataSerieDialog(QString defaultType, QWidget *parent) :
10 QDialog(parent)
10 QDialog(parent)
11 {
11 {
12 // Combo box for selecting the series type
12 // Combo box for selecting the series type
@@ -18,6 +18,13 DataSerieDialog::DataSerieDialog(QWidget *parent) :
18 m_seriesTypeCombo->addItem("Scatter");
18 m_seriesTypeCombo->addItem("Scatter");
19 m_seriesTypeCombo->addItem("Spline");
19 m_seriesTypeCombo->addItem("Spline");
20
20
21 // Allow pre-selection of a series type
22 if (defaultType != "") {
23 int index = m_seriesTypeCombo->findText(defaultType);
24 if (index > 0)
25 m_seriesTypeCombo->setCurrentIndex(index);
26 }
27
21 // Combo box for selecting data for the new series
28 // Combo box for selecting data for the new series
22 m_testDataCombo = new QComboBox(this);
29 m_testDataCombo = new QComboBox(this);
23 m_testDataCombo->addItem("linear");
30 m_testDataCombo->addItem("linear");
@@ -9,7 +9,7 class DataSerieDialog : public QDialog
9 {
9 {
10 Q_OBJECT
10 Q_OBJECT
11 public:
11 public:
12 explicit DataSerieDialog(QWidget *parent = 0);
12 explicit DataSerieDialog(QString defaultType, QWidget *parent = 0);
13
13
14 signals:
14 signals:
15 void accepted(QString series, QString data);
15 void accepted(QString series, QString data);
@@ -91,7 +91,7 MainWidget::MainWidget(QWidget *parent) :
91
91
92 void MainWidget::addSeries()
92 void MainWidget::addSeries()
93 {
93 {
94 DataSerieDialog dialog(this);
94 DataSerieDialog dialog(m_defaultSeries, this);
95 connect(&dialog, SIGNAL(accepted(QString, QString)), this, SLOT(addSeries(QString, QString)));
95 connect(&dialog, SIGNAL(accepted(QString, QString)), this, SLOT(addSeries(QString, QString)));
96 dialog.exec();
96 dialog.exec();
97 }
97 }
@@ -99,6 +99,7 void MainWidget::addSeries()
99 void MainWidget::addSeries(QString series, QString data)
99 void MainWidget::addSeries(QString series, QString data)
100 {
100 {
101 qDebug() << "addSeries: " << series << " data: " << data;
101 qDebug() << "addSeries: " << series << " data: " << data;
102 m_defaultSeries = series;
102
103
103 QXYChartSeries* series0 = new QXYChartSeries();
104 QXYChartSeries* series0 = new QXYChartSeries();
104
105
@@ -37,6 +37,7 private:
37 QSpinBox *m_xMaxSpin;
37 QSpinBox *m_xMaxSpin;
38 QSpinBox *m_yMinSpin;
38 QSpinBox *m_yMinSpin;
39 QSpinBox *m_yMaxSpin;
39 QSpinBox *m_yMaxSpin;
40 QString m_defaultSeries;
40 };
41 };
41
42
42 #endif // MAINWIDGET_H
43 #endif // MAINWIDGET_H
General Comments 0
You need to be logged in to leave comments. Login now