##// END OF EJS Templates
Fixed spline's broken signals
Marek Rosa -
r1275:5883c94a00fe
parent child
Show More
@@ -59,6 +59,10 QTCOMMERCIALCHART_BEGIN_NAMESPACE
59 QSplineSeries::QSplineSeries(QObject *parent) :
59 QSplineSeries::QSplineSeries(QObject *parent) :
60 QLineSeries(*new QSplineSeriesPrivate(this),parent)
60 QLineSeries(*new QSplineSeriesPrivate(this),parent)
61 {
61 {
62 Q_D(QSplineSeries);
63 QObject::connect(this,SIGNAL(pointAdded(int)), d, SLOT(updateControlPoints()));
64 QObject::connect(this,SIGNAL(pointRemoved(int)), d, SLOT(updateControlPoints()));
65 QObject::connect(this,SIGNAL(pointReplaced(int)), d, SLOT(updateControlPoints()));
62 }
66 }
63
67
64 QSplineSeries::~QSplineSeries()
68 QSplineSeries::~QSplineSeries()
@@ -78,9 +82,9 QAbstractSeries::SeriesType QSplineSeries::type() const
78
82
79 QSplineSeriesPrivate::QSplineSeriesPrivate(QSplineSeries* q):QLineSeriesPrivate(q)
83 QSplineSeriesPrivate::QSplineSeriesPrivate(QSplineSeries* q):QLineSeriesPrivate(q)
80 {
84 {
81 QObject::connect(this,SIGNAL(pointAdded(int)), this, SLOT(updateControlPoints()));
85 // QObject::connect(this,SIGNAL(pointAdded(int)), this, SLOT(updateControlPoints()));
82 QObject::connect(this,SIGNAL(pointRemoved(int)), this, SLOT(updateControlPoints()));
86 // QObject::connect(this,SIGNAL(pointRemoved(int)), this, SLOT(updateControlPoints()));
83 QObject::connect(this,SIGNAL(pointReplaced(int)), this, SLOT(updateControlPoints()));
87 // QObject::connect(this,SIGNAL(pointReplaced(int)), this, SLOT(updateControlPoints()));
84 };
88 };
85
89
86 /*!
90 /*!
@@ -210,7 +210,7 void TableWidget::updateChartType(bool toggle)
210
210
211 if (m_lineRadioButton->isChecked())
211 if (m_lineRadioButton->isChecked())
212 {
212 {
213 m_chart->setAnimationOptions(QChart::NoAnimation);
213 m_chart->setAnimationOptions(QChart::NoAnimation);
214
214
215 // series 1
215 // series 1
216 m_series = new QLineSeries(this);
216 m_series = new QLineSeries(this);
@@ -221,7 +221,7 void TableWidget::updateChartType(bool toggle)
221 mapper->setXColumn(0);
221 mapper->setXColumn(0);
222 mapper->setYColumn(1);
222 mapper->setYColumn(1);
223 mapper->setFirst(3);
223 mapper->setFirst(3);
224 mapper->setCount(4);
224 mapper->setCount(4);
225
225
226 // m_series->setModelMapping(0,1, Qt::Vertical);
226 // m_series->setModelMapping(0,1, Qt::Vertical);
227 // m_series->setModelMappingRange(3, 4);
227 // m_series->setModelMappingRange(3, 4);
@@ -262,23 +262,25 void TableWidget::updateChartType(bool toggle)
262 }
262 }
263 else if (m_splineRadioButton->isChecked())
263 else if (m_splineRadioButton->isChecked())
264 {
264 {
265 // m_chart->setAnimationOptions(QChart::NoAnimation);
265 m_chart->setAnimationOptions(QChart::NoAnimation);
266
266
267 // // series 1
267 // series 1
268 // m_series = new QSplineSeries;
268 m_series = new QSplineSeries;
269 // m_series->setModel(m_model);
269 // m_series->setModel(m_model);
270
270
271 // QXYModelMapper *mapper = new QXYModelMapper;
271 QVXYModelMapper *mapper = new QVXYModelMapper;
272 // mapper->setMapX(0);
272 mapper->setSeries(m_series);
273 // mapper->setMapY(1);
273 mapper->setModel(m_model);
274 // mapper->setFirst(0);
274 mapper->setXColumn(0);
275 // mapper->setCount(-1);
275 mapper->setYColumn(1);
276 mapper->setFirst(0);
277 mapper->setCount(-1);
276
278
277 // m_series->setModelMapper(mapper);
279 // m_series->setModelMapper(mapper);
278
280
279 // m_chart->addSeries(m_series);
281 m_chart->addSeries(m_series);
280 // seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper();
282 seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper();
281 // m_model->addMapping(seriesColorHex, QRect(0, 0, 2, 1000));
283 m_model->addMapping(seriesColorHex, QRect(0, 0, 2, 1000));
282
284
283 // // series 2
285 // // series 2
284 // m_series = new QSplineSeries;
286 // m_series = new QSplineSeries;
@@ -524,9 +526,9 void TableWidget::testPie3()
524
526
525 void TableWidget::testXY()
527 void TableWidget::testXY()
526 {
528 {
527 // if (m_series->type() != QAbstractSeries::SeriesTypeLine) {
529 // if (m_series->type() != QAbstractSeries::SeriesTypeLine) {
528 // m_series->append(QPointF(150, 75));
530 // m_series->append(QPointF(150, 75));
529 // }
531 // }
530
532
531 if (m_series->count() > 0) {
533 if (m_series->count() > 0) {
532 m_series->remove(m_series->points().last());
534 m_series->remove(m_series->points().last());
General Comments 0
You need to be logged in to leave comments. Login now