##// END OF EJS Templates
Clean up obsolete create metods in series
Michal Klocek -
r156:68a8d6592838
parent child
Show More
@@ -15,11 +15,11 int main(int argc, char *argv[])
15 15
16 16 QMainWindow window;
17 17
18 QLineChartSeries* series0 = QLineChartSeries::create();
18 QLineChartSeries* series0 = new QLineChartSeries();
19 19 QPen blue(Qt::blue);
20 20 blue.setWidth(3);
21 21 series0->setPen(blue);
22 QLineChartSeries* series1 = QLineChartSeries::create();
22 QLineChartSeries* series1 = new QLineChartSeries();
23 23 QPen red(Qt::red);
24 24 red.setWidth(3);
25 25 series1->setPen(red);
@@ -13,11 +13,11 int main(int argc, char *argv[])
13 13
14 14 QMainWindow window;
15 15
16 QLineChartSeries* series0 = QLineChartSeries::create();
16 QLineChartSeries* series0 = new QLineChartSeries();
17 17 QPen blue(Qt::blue);
18 18 blue.setWidth(3);
19 19 series0->setPen(blue);
20 QLineChartSeries* series1 = QLineChartSeries::create();
20 QLineChartSeries* series1 = new QLineChartSeries();
21 21 QPen red(Qt::red);
22 22 red.setWidth(3);
23 23 series1->setPen(red);
@@ -15,11 +15,11 int main(int argc, char *argv[])
15 15
16 16 QMainWindow window;
17 17
18 QLineChartSeries* series0 = QLineChartSeries::create();
18 QLineChartSeries* series0 = new QLineChartSeries();
19 19 QPen blue(Qt::blue);
20 20 blue.setWidth(3);
21 21 series0->setPen(blue);
22 QLineChartSeries* series1 = QLineChartSeries::create();
22 QLineChartSeries* series1 = new QLineChartSeries();
23 23 QPen red(Qt::red);
24 24 red.setWidth(3);
25 25 series1->setPen(red);
@@ -14,11 +14,11 int main(int argc, char *argv[])
14 14
15 15 QMainWindow window;
16 16
17 QLineChartSeries* series0 = QLineChartSeries::create();
17 QLineChartSeries* series0 = new QLineChartSeries();
18 18 QPen blue(Qt::blue);
19 19 blue.setWidth(3);
20 20 series0->setPen(blue);
21 QLineChartSeries* series1 = QLineChartSeries::create();
21 QLineChartSeries* series1 = new QLineChartSeries();
22 22 QPen red(Qt::red);
23 23 red.setWidth(3);
24 24 series1->setPen(red);
@@ -267,26 +267,6 void ChartPresenter::removeAxis(QChartAxis* axis)
267 267 else if(axis == m_axisY) m_axisY=0;
268 268 }
269 269
270 /*
271 void ChartPresenter::setAxisX(const QChartAxis& axis)
272 {
273 setAxis(m_axisXItem,axis);
274 }
275 void ChartPresenter::setAxisY(const QChartAxis& axis)
276 {
277 setAxis(m_axisYItem.at(0),axis);
278 }
279
280 void ChartPresenter::setAxisY(const QList<QChartAxis>& axis)
281 {
282 //TODO not implemented
283 }
284
285 void ChartPresenter::setAxis(AxisItem *item, const QChartAxis& axis)
286 {
287 item->setVisible(axis.isAxisVisible());
288 }
289 */
290 270 #include "moc_chartpresenter_p.cpp"
291 271
292 272 QTCOMMERCIALCHART_END_NAMESPACE
@@ -10,13 +10,6 QLineChartSeries::~QLineChartSeries()
10 10 {
11 11 }
12 12
13 QLineChartSeries* QLineChartSeries::create(QObject* parent)
14 {
15 //TODO: here we take QChartData when it is ready
16 // return null if malformed;
17 return new QLineChartSeries(parent);
18 }
19
20 13 int QLineChartSeries::add(qreal x,qreal y)
21 14 {
22 15 m_x<<x;
@@ -12,13 +12,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
12 12 class QTCOMMERCIALCHART_EXPORT QLineChartSeries : public QChartSeries
13 13 {
14 14 Q_OBJECT
15 private:
16 QLineChartSeries(QObject* parent=0);
17 15 public:
16 QLineChartSeries(QObject* parent=0);
18 17 virtual ~QLineChartSeries();
19 18
20 19 public: // from QChartSeries
21 static QLineChartSeries* create(QObject* parent=0);
22 20 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeLine;}
23 21
24 22 public:
@@ -42,7 +42,7 QChartSeries* QChart::createSeries(QChartSeries::QChartSeriesType type)
42 42
43 43 switch (type) {
44 44 case QChartSeries::SeriesTypeLine: {
45 series = QLineChartSeries::create();
45 series = new QLineChartSeries(this);
46 46 break;
47 47 }
48 48 case QChartSeries::SeriesTypeBar: {
@@ -1,34 +1,5
1 #include "qchartglobal.h"
2 1 #include "qchartseries.h"
3 2
4 #include "barchartseries.h"
5 #include "qlinechartseries.h"
6
7 3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
9 QChartSeries* QChartSeries::create(QChartSeriesType type, QObject* parent)
10 {
11 qDebug() << "QChartSeries::create";
12 // TODO: Other types
13 switch (type) {
14 case QChartSeries::SeriesTypeLine: {
15 QLineChartSeries* s = QLineChartSeries::create(parent); // TODO: do we need create method for derived implementations?
16 return s;
17 }
18 case QChartSeries::SeriesTypePie: {
19 return 0;
20 }
21 case QChartSeries::SeriesTypeScatter: {
22 return 0;
23 }
24 case QChartSeries::SeriesTypeBar: {
25 BarChartSeries* s = new BarChartSeries(parent);
26 return s;
27 }
28 default:
29 return 0;
30 }
31 }
32
33 4 #include "moc_qchartseries.cpp"
34 5 QTCOMMERCIALCHART_END_NAMESPACE
@@ -29,9 +29,6 protected:
29 29 public:
30 30 virtual ~QChartSeries(){};
31 31
32 // Factory method
33 static QChartSeries* create(QChartSeriesType type, QObject* parent = 0 );
34
35 32 // Pure virtual
36 33 virtual QChartSeriesType type() const = 0;
37 34
@@ -223,7 +223,7 void MainWidget::addSeries(QString series, QString data)
223 223 // lineSeries->add(x.at(i), y.at(i));
224 224 // }
225 225 //Q_ASSERT(newSeries->setData(x, y));
226 QLineChartSeries* series0 = QLineChartSeries::create();
226 QLineChartSeries* series0 = new QLineChartSeries();
227 227 for (int i(0); i < x.count() && i < y.count(); i++)
228 228 series0->add(x.at(i), y.at(i));
229 229 m_chartWidget->addSeries(series0);
@@ -236,7 +236,7 void MainWidget::addSeries(QString series, QString data)
236 236 if (series == "Bar") {
237 237 // This is the another way of creating series. Should we create test cases for both ways, if we support them?
238 238 qDebug() << "Bar chart series";
239 newSeries = QChartSeries::create(QChartSeries::SeriesTypeBar, this);
239 newSeries = new BarChartSeries(this);
240 240
241 241 // Create some test data to chart
242 242 QStandardItemModel dataModel(2,10,this);
General Comments 0
You need to be logged in to leave comments. Login now