From bda5257e118d684b2b60f619cca1976198c9a6e7 2012-03-06 09:27:50 From: Michal Klocek Date: 2012-03-06 09:27:50 Subject: [PATCH] Spline series windows compilation fix --- diff --git a/src/linechart/qlineseries.cpp b/src/linechart/qlineseries.cpp index 4c02713..009e8d5 100644 --- a/src/linechart/qlineseries.cpp +++ b/src/linechart/qlineseries.cpp @@ -66,8 +66,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE Constructs empty series object which is a child of \a parent. When series object is added to QChartView or QChart instance ownerships is transfered. */ -QLineSeries::QLineSeries(QObject* parent):QXYSeries(parent), -m_pointsVisible(false) +QLineSeries::QLineSeries(QObject* parent):QXYSeries(parent) { } /*! @@ -78,28 +77,6 @@ QLineSeries::~QLineSeries() { } -/*! - Sets \a pen used for drawing given series.. -*/ -void QLineSeries::setPen(const QPen& pen) -{ - if(pen!=m_pen){ - m_pen=pen; - emit updated(); - } -} - -/*! - Sets if data points are \a visible and should be drawn on line. -*/ -void QLineSeries::setPointsVisible(bool visible) -{ - if(m_pointsVisible!=visible){ - m_pointsVisible=visible; - emit updated(); - } -} - QDebug operator<< (QDebug debug, const QLineSeries series) { Q_ASSERT(series.m_x.size() == series.m_y.size()); diff --git a/src/linechart/qlineseries.h b/src/linechart/qlineseries.h index d83ad85..56902f6 100644 --- a/src/linechart/qlineseries.h +++ b/src/linechart/qlineseries.h @@ -18,16 +18,8 @@ public: public: // from QChartSeries virtual QSeriesType type() const {return QSeries::SeriesTypeLine;} - void setPen(const QPen& pen); - QPen pen() const {return m_pen;} - - void setPointsVisible(bool visible); - bool pointsVisible() const {return m_pointsVisible;} - friend QDebug operator<< (QDebug d, const QLineSeries series); -private: - QPen m_pen; - bool m_pointsVisible; + }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/splinechart/qsplineseries.cpp b/src/splinechart/qsplineseries.cpp index 5c7bfa2..9d73915 100644 --- a/src/splinechart/qsplineseries.cpp +++ b/src/splinechart/qsplineseries.cpp @@ -26,7 +26,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ QSplineSeries::QSplineSeries(QObject *parent) : - QLineSeries(parent) + QXYSeries(parent) { connect(this,SIGNAL(pointAdded(int)), this, SLOT(updateControlPoints())); connect(this,SIGNAL(pointRemoved(int)), this, SLOT(updateControlPoints())); diff --git a/src/splinechart/qsplineseries.h b/src/splinechart/qsplineseries.h index 9385638..4e5f8b3 100644 --- a/src/splinechart/qsplineseries.h +++ b/src/splinechart/qsplineseries.h @@ -3,38 +3,39 @@ #include "qchartglobal.h" #include -#include "qlineseries.h" +#include "qxyseries.h" #include #include QTCOMMERCIALCHART_BEGIN_NAMESPACE -class QSplineSeries : public QLineSeries +class QTCOMMERCIALCHART_EXPORT QSplineSeries : public QXYSeries { Q_OBJECT - public: +public: QSplineSeries(QObject *parent = 0); - QSeriesType type() const { return QSeries::SeriesTypeSpline; } + QSeriesType type() const {return QSeries::SeriesTypeSpline;} // int count() const { return m_x.size(); } - QPointF controlPoint(int index) const { return m_controlPoints[index]; } + QPointF controlPoint(int index) const {return m_controlPoints[index];} // TODO: allow the user to set custom control points // void setCustomControlPoints(QList controlPoints); // bool calculateControlPointsAutomatically(); // void setCalculateControlPointsAutomatically(); - private: + +private: void calculateControlPoints(); QList getFirstControlPoints(QList rhs); - private slots: +private slots: void updateControlPoints(); - private: +private: QList m_controlPoints; - + }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/xychart/qxyseries.cpp b/src/xychart/qxyseries.cpp index 56001bf..a802b5e 100644 --- a/src/xychart/qxyseries.cpp +++ b/src/xychart/qxyseries.cpp @@ -66,7 +66,8 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE Constructs empty series object which is a child of \a parent. When series object is added to QChartView or QChart instance ownerships is transfered. */ -QXYSeries::QXYSeries(QObject* parent):QSeries(parent) +QXYSeries::QXYSeries(QObject* parent):QSeries(parent), +m_pointsVisible(false) { } /*! @@ -173,6 +174,29 @@ int QXYSeries::count() const } /*! + Sets \a pen used for drawing given series.. +*/ +void QXYSeries::setPen(const QPen& pen) +{ + if(pen!=m_pen){ + m_pen=pen; + emit updated(); + } +} + +/*! + Sets if data points are \a visible and should be drawn on line. +*/ +void QXYSeries::setPointsVisible(bool visible) +{ + if(m_pointsVisible!=visible){ + m_pointsVisible=visible; + emit updated(); + } +} + + +/*! Stream operator for adding a data \a point to the series. \sa add() */ diff --git a/src/xychart/qxyseries.h b/src/xychart/qxyseries.h index 2cc71bf..1f877e7 100644 --- a/src/xychart/qxyseries.h +++ b/src/xychart/qxyseries.h @@ -31,6 +31,12 @@ public: QXYSeries& operator << (const QPointF &point); + void setPen(const QPen& pen); + QPen pen() const {return m_pen;} + + void setPointsVisible(bool visible); + bool pointsVisible() const {return m_pointsVisible;} + signals: void updated(); void pointReplaced(int index); @@ -42,6 +48,9 @@ protected: QVector m_x; QVector m_y; + QPen m_pen; + bool m_pointsVisible; + }; QTCOMMERCIALCHART_END_NAMESPACE