From 49ff5e3c0df210b0852be58345bfbb9992187caa 2012-03-05 13:35:15 From: Marek Rosa Date: 2012-03-05 13:35:15 Subject: [PATCH] Some spline fixes --- diff --git a/src/splinechart/splinepresenter.cpp b/src/splinechart/splinepresenter.cpp index b2fe80b..1547970 100644 --- a/src/splinechart/splinepresenter.cpp +++ b/src/splinechart/splinepresenter.cpp @@ -25,6 +25,7 @@ void SplinePresenter::applyGeometry(QVector& points) { if(points.size()==0) return; + qDebug() << "Kueku"; QPainterPath splinePath; const QPointF& point = points.at(0); splinePath.moveTo(point); diff --git a/src/splinechart/splinepresenter_p.h b/src/splinechart/splinepresenter_p.h index 84860df..fa4a295 100644 --- a/src/splinechart/splinepresenter_p.h +++ b/src/splinechart/splinepresenter_p.h @@ -20,12 +20,7 @@ public: QPointF calculateGeometryControlPoint(int index) const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); - -signals: - -public slots: - + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/test/chartwidgettest/mainwidget.cpp b/test/chartwidgettest/mainwidget.cpp index b4ccb1d..0dea456 100644 --- a/test/chartwidgettest/mainwidget.cpp +++ b/test/chartwidgettest/mainwidget.cpp @@ -3,6 +3,7 @@ #include "qpieseries.h" #include "qscatterseries.h" #include +#include "qsplineseries.h" #include #include #include @@ -200,7 +201,7 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS QList data = generateTestData(columnCount, rowCount, dataCharacteristics); // Line series and scatter series use similar data - if (seriesName.contains("line", Qt::CaseInsensitive)) { + if (seriesName.contains("qline", Qt::CaseInsensitive)) { for (int j(0); j < data.count(); j ++) { QList column = data.at(j); QLineSeries *series = new QLineSeries(); @@ -215,7 +216,7 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS QList column = data.at(j); QScatterSeries *series = new QScatterSeries(); for (int i(0); i < column.count(); i++) { - (*series) << QPointF(i, column.at(i)); + (*series) << QPointF(i, column.at(i)); } m_chartView->addSeries(series); setCurrentSeries(series); @@ -254,6 +255,7 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS } series->addBarSet(set); } + // TODO: new implementation of setFloatingValuesEnabled with signals //series->setFloatingValuesEnabled(true); series->setToolTipEnabled(true); @@ -261,8 +263,19 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS m_chartView->addSeries(series); setCurrentSeries(series); } + else if (seriesName.contains("spline", Qt::CaseInsensitive)) { + for (int j(0); j < data.count(); j ++) { + QList column = data.at(j); + QSplineSeries *series = new QSplineSeries(); + for (int i(0); i < column.count(); i++) { + series->add(i, column.at(i)); + } + m_chartView->addSeries(series); + setCurrentSeries(series); + } - // TODO: spline and area + // TODO: area + } } void MainWidget::setCurrentSeries(QSeries *series) @@ -285,6 +298,8 @@ void MainWidget::setCurrentSeries(QSeries *series) case QSeries::SeriesTypePercentBar: qDebug() << "setCurrentSeries (Percentbar)"; break; + case QSeries::SeriesTypeSpline: + break; default: Q_ASSERT(false); break;