From ff848436837ea079fc8fee4f5f19c5bc80888fbd 2012-03-09 07:38:57 From: Tero Ahola Date: 2012-03-09 07:38:57 Subject: [PATCH] Fixed area series handling in chartwidgettest --- diff --git a/test/chartwidgettest/mainwidget.cpp b/test/chartwidgettest/mainwidget.cpp index cff07cf..cbeff81 100644 --- a/test/chartwidgettest/mainwidget.cpp +++ b/test/chartwidgettest/mainwidget.cpp @@ -210,9 +210,8 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS series->add(i, column.at(i)); } m_chartView->addSeries(series); - setCurrentSeries(series); } - } if (seriesName == "Area") { + } else if (seriesName == "Area") { // TODO: lower series for the area? for (int j(0); j < data.count(); j ++) { QList column = data.at(j); @@ -222,7 +221,6 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS } QAreaSeries *areaSeries = new QAreaSeries(lineSeries); m_chartView->addSeries(areaSeries); - setCurrentSeries(areaSeries); } } else if (seriesName == "Scatter") { for (int j(0); j < data.count(); j++) { @@ -232,7 +230,6 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS (*series) << QPointF(i, column.at(i)); } m_chartView->addSeries(series); - setCurrentSeries(series); } } else if (seriesName == "Pie") { QStringList labels = generateLabels(rowCount); @@ -243,7 +240,6 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS series->add(column.at(i), labels.at(i)); } m_chartView->addSeries(series); - setCurrentSeries(series); } } else if (seriesName == "Bar" || seriesName == "Stacked bar" @@ -274,7 +270,6 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS series->setToolTipEnabled(true); series->setSeparatorsVisible(false); m_chartView->addSeries(series); - setCurrentSeries(series); } else if (seriesName == "Spline") { for (int j(0); j < data.count(); j ++) { QList column = data.at(j); @@ -283,38 +278,6 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS series->add(i, column.at(i)); } m_chartView->addSeries(series); - setCurrentSeries(series); - } - - // TODO: area - } -} - -void MainWidget::setCurrentSeries(QSeries *series) -{ - if (series) { - m_currentSeries = series; - switch (m_currentSeries->type()) { - case QSeries::SeriesTypeLine: - break; - case QSeries::SeriesTypeScatter: - break; - case QSeries::SeriesTypePie: - break; - case QSeries::SeriesTypeBar: - qDebug() << "setCurrentSeries (bar)"; - break; - case QSeries::SeriesTypeStackedBar: - qDebug() << "setCurrentSeries (Stackedbar)"; - break; - case QSeries::SeriesTypePercentBar: - qDebug() << "setCurrentSeries (Percentbar)"; - break; - case QSeries::SeriesTypeSpline: - break; - default: - Q_ASSERT(false); - break; } } } diff --git a/test/chartwidgettest/mainwidget.h b/test/chartwidgettest/mainwidget.h index 567e27c..690a976 100644 --- a/test/chartwidgettest/mainwidget.h +++ b/test/chartwidgettest/mainwidget.h @@ -38,7 +38,6 @@ private slots: void yMinChanged(int value); void yMaxChanged(int value); void antiAliasToggled(bool enabled); - void setCurrentSeries(QSeries *series); void changeChartTheme(int themeIndex); QList generateTestData(int columnCount, int rowCount, QString dataCharacteristics); QStringList generateLabels(int count); @@ -52,7 +51,6 @@ private: QSpinBox *m_yMinSpin; QSpinBox *m_yMaxSpin; QString m_defaultSeriesName; - QSeries *m_currentSeries; QGridLayout *m_scatterLayout; };