##// END OF EJS Templates
Merge remote-tracking branch 'origin/5.6' into 5.7...
Liang Qi -
r2878:97bb01ce5d85 merge
parent child
Show More
@@ -0,0 +1,8
1 Qt Charts 2.1.1
2
3 Fixed issues
4 ------------
5 - Fixed crash with empty BarSet values
6 - Fixed model resetting with model mapper
7 - Fixed crash when axis range is infinite
8 - Fixed clearing the chart title
@@ -53,8 +53,8 class QT_CHARTS_EXPORT QAreaSeries : public QAbstractSeries
53 Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged)
53 Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged)
54
54
55 public:
55 public:
56 explicit QAreaSeries(QObject *parent = 0);
56 explicit QAreaSeries(QObject *parent = Q_NULLPTR);
57 explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0);
57 explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = Q_NULLPTR);
58 ~QAreaSeries();
58 ~QAreaSeries();
59
59
60 public:
60 public:
@@ -45,11 +45,11 class QT_CHARTS_EXPORT QBarCategoryAxis : public QAbstractAxis
45 Q_PROPERTY(int count READ count NOTIFY countChanged)
45 Q_PROPERTY(int count READ count NOTIFY countChanged)
46
46
47 public:
47 public:
48 explicit QBarCategoryAxis(QObject *parent = 0);
48 explicit QBarCategoryAxis(QObject *parent = Q_NULLPTR);
49 ~QBarCategoryAxis();
49 ~QBarCategoryAxis();
50
50
51 protected:
51 protected:
52 QBarCategoryAxis(QBarCategoryAxisPrivate &d, QObject *parent = 0);
52 QBarCategoryAxis(QBarCategoryAxisPrivate &d, QObject *parent = Q_NULLPTR);
53
53
54 public:
54 public:
55 AxisType type() const;
55 AxisType type() const;
@@ -53,11 +53,11 public:
53 AxisLabelsPositionOnValue = 0x1
53 AxisLabelsPositionOnValue = 0x1
54 };
54 };
55
55
56 explicit QCategoryAxis(QObject *parent = 0);
56 explicit QCategoryAxis(QObject *parent = Q_NULLPTR);
57 ~QCategoryAxis();
57 ~QCategoryAxis();
58
58
59 protected:
59 protected:
60 QCategoryAxis(QCategoryAxisPrivate &d, QObject *parent = 0);
60 QCategoryAxis(QCategoryAxisPrivate &d, QObject *parent = Q_NULLPTR);
61
61
62 public:
62 public:
63 AxisType type() const;
63 AxisType type() const;
@@ -49,11 +49,11 class QT_CHARTS_EXPORT QDateTimeAxis : public QAbstractAxis
49 Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
49 Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
50
50
51 public:
51 public:
52 explicit QDateTimeAxis(QObject *parent = 0);
52 explicit QDateTimeAxis(QObject *parent = Q_NULLPTR);
53 ~QDateTimeAxis();
53 ~QDateTimeAxis();
54
54
55 protected:
55 protected:
56 QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent = 0);
56 QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent = Q_NULLPTR);
57
57
58 public:
58 public:
59 AxisType type() const;
59 AxisType type() const;
@@ -49,11 +49,11 class QT_CHARTS_EXPORT QLogValueAxis : public QAbstractAxis
49 Q_PROPERTY(qreal base READ base WRITE setBase NOTIFY baseChanged)
49 Q_PROPERTY(qreal base READ base WRITE setBase NOTIFY baseChanged)
50
50
51 public:
51 public:
52 explicit QLogValueAxis(QObject *parent = 0);
52 explicit QLogValueAxis(QObject *parent = Q_NULLPTR);
53 ~QLogValueAxis();
53 ~QLogValueAxis();
54
54
55 protected:
55 protected:
56 QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent = 0);
56 QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent = Q_NULLPTR);
57
57
58 public:
58 public:
59 AxisType type() const;
59 AxisType type() const;
@@ -92,7 +92,7 public:
92 Q_DECLARE_FLAGS(AxisTypes, AxisType)
92 Q_DECLARE_FLAGS(AxisTypes, AxisType)
93
93
94 protected:
94 protected:
95 explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = 0);
95 explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = Q_NULLPTR);
96
96
97 public:
97 public:
98 ~QAbstractAxis();
98 ~QAbstractAxis();
@@ -37,7 +37,7
37 #include <private/chartdataset_p.h>
37 #include <private/chartdataset_p.h>
38 #include <private/chartpresenter_p.h>
38 #include <private/chartpresenter_p.h>
39 #include <private/charttheme_p.h>
39 #include <private/charttheme_p.h>
40
40 #include <private/charthelpers_p.h>
41
41
42 QT_CHARTS_BEGIN_NAMESPACE
42 QT_CHARTS_BEGIN_NAMESPACE
43 /*!
43 /*!
@@ -390,6 +390,12 void QValueAxisPrivate::setRange(qreal min, qreal max)
390 if (min > max)
390 if (min > max)
391 return;
391 return;
392
392
393 if (!isValidValue(min, max)) {
394 qWarning() << "Attempting to set invalid range for value axis: ["
395 << min << " - " << max << "]";
396 return;
397 }
398
393 bool changeMin = false;
399 bool changeMin = false;
394 if (m_min == 0 || min == 0)
400 if (m_min == 0 || min == 0)
395 changeMin = !qFuzzyCompare(1 + m_min, 1 + min);
401 changeMin = !qFuzzyCompare(1 + m_min, 1 + min);
@@ -46,11 +46,11 class QT_CHARTS_EXPORT QValueAxis : public QAbstractAxis
46 Q_PROPERTY(int minorTickCount READ minorTickCount WRITE setMinorTickCount NOTIFY minorTickCountChanged)
46 Q_PROPERTY(int minorTickCount READ minorTickCount WRITE setMinorTickCount NOTIFY minorTickCountChanged)
47
47
48 public:
48 public:
49 explicit QValueAxis(QObject *parent = 0);
49 explicit QValueAxis(QObject *parent = Q_NULLPTR);
50 ~QValueAxis();
50 ~QValueAxis();
51
51
52 protected:
52 protected:
53 QValueAxis(QValueAxisPrivate &d, QObject *parent = 0);
53 QValueAxis(QValueAxisPrivate &d, QObject *parent = Q_NULLPTR);
54
54
55 public:
55 public:
56 AxisType type() const;
56 AxisType type() const;
@@ -40,7 +40,7 class QT_CHARTS_EXPORT QHorizontalBarSeries : public QAbstractBarSeries
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42 public:
42 public:
43 explicit QHorizontalBarSeries(QObject *parent = 0);
43 explicit QHorizontalBarSeries(QObject *parent = Q_NULLPTR);
44 ~QHorizontalBarSeries();
44 ~QHorizontalBarSeries();
45 QAbstractSeries::SeriesType type() const;
45 QAbstractSeries::SeriesType type() const;
46
46
@@ -40,7 +40,7 class QT_CHARTS_EXPORT QHorizontalPercentBarSeries : public QAbstractBarSeries
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42 public:
42 public:
43 explicit QHorizontalPercentBarSeries(QObject *parent = 0);
43 explicit QHorizontalPercentBarSeries(QObject *parent = Q_NULLPTR);
44 ~QHorizontalPercentBarSeries();
44 ~QHorizontalPercentBarSeries();
45 QAbstractSeries::SeriesType type() const;
45 QAbstractSeries::SeriesType type() const;
46
46
@@ -40,7 +40,7 class QT_CHARTS_EXPORT QHorizontalStackedBarSeries : public QAbstractBarSeries
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42 public:
42 public:
43 explicit QHorizontalStackedBarSeries(QObject *parent = 0);
43 explicit QHorizontalStackedBarSeries(QObject *parent = Q_NULLPTR);
44 ~QHorizontalStackedBarSeries();
44 ~QHorizontalStackedBarSeries();
45 QAbstractSeries::SeriesType type() const;
45 QAbstractSeries::SeriesType type() const;
46
46
@@ -86,7 +86,7 public:
86 QAbstractBarSeries::LabelsPosition labelsPosition() const;
86 QAbstractBarSeries::LabelsPosition labelsPosition() const;
87
87
88 protected:
88 protected:
89 explicit QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *parent = 0);
89 explicit QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *parent = Q_NULLPTR);
90
90
91 Q_SIGNALS:
91 Q_SIGNALS:
92 void clicked(int index, QBarSet *barset);
92 void clicked(int index, QBarSet *barset);
@@ -60,6 +60,7 void QBarModelMapper::setModel(QAbstractItemModel *model)
60 d->m_model = model;
60 d->m_model = model;
61 d->initializeBarFromModel();
61 d->initializeBarFromModel();
62 // connect signals from the model
62 // connect signals from the model
63 connect(d->m_model, SIGNAL(modelReset()), d, SLOT(initializeBarFromModel()));
63 connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
64 connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
64 connect(d->m_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), d, SLOT(modelHeaderDataUpdated(Qt::Orientation,int,int)));
65 connect(d->m_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), d, SLOT(modelHeaderDataUpdated(Qt::Orientation,int,int)));
65 connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
66 connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
@@ -47,7 +47,7 class QT_CHARTS_EXPORT QBarModelMapper : public QObject
47 Q_OBJECT
47 Q_OBJECT
48
48
49 protected:
49 protected:
50 explicit QBarModelMapper(QObject *parent = 0);
50 explicit QBarModelMapper(QObject *parent = Q_NULLPTR);
51
51
52 QAbstractItemModel *model() const;
52 QAbstractItemModel *model() const;
53 void setModel(QAbstractItemModel *model);
53 void setModel(QAbstractItemModel *model);
@@ -51,7 +51,7 class QT_CHARTS_EXPORT QBarSet : public QObject
51 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
51 Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged)
52
52
53 public:
53 public:
54 explicit QBarSet(const QString label, QObject *parent = 0);
54 explicit QBarSet(const QString label, QObject *parent = Q_NULLPTR);
55 virtual ~QBarSet();
55 virtual ~QBarSet();
56
56
57 void setLabel(const QString label);
57 void setLabel(const QString label);
@@ -45,7 +45,7 class QT_CHARTS_EXPORT QHBarModelMapper : public QBarModelMapper
45 Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
45 Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
46
46
47 public:
47 public:
48 explicit QHBarModelMapper(QObject *parent = 0);
48 explicit QHBarModelMapper(QObject *parent = Q_NULLPTR);
49
49
50 QAbstractItemModel *model() const;
50 QAbstractItemModel *model() const;
51 void setModel(QAbstractItemModel *model);
51 void setModel(QAbstractItemModel *model);
@@ -45,7 +45,7 class QT_CHARTS_EXPORT QVBarModelMapper : public QBarModelMapper
45 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
45 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
46
46
47 public:
47 public:
48 explicit QVBarModelMapper(QObject *parent = 0);
48 explicit QVBarModelMapper(QObject *parent = Q_NULLPTR);
49
49
50 QAbstractItemModel *model() const;
50 QAbstractItemModel *model() const;
51 void setModel(QAbstractItemModel *model);
51 void setModel(QAbstractItemModel *model);
@@ -40,7 +40,7 class QT_CHARTS_EXPORT QBarSeries : public QAbstractBarSeries
40 {
40 {
41 Q_OBJECT
41 Q_OBJECT
42 public:
42 public:
43 explicit QBarSeries(QObject *parent = 0);
43 explicit QBarSeries(QObject *parent = Q_NULLPTR);
44 ~QBarSeries();
44 ~QBarSeries();
45 QAbstractSeries::SeriesType type() const;
45 QAbstractSeries::SeriesType type() const;
46
46
@@ -41,7 +41,7 class QT_CHARTS_EXPORT QPercentBarSeries : public QAbstractBarSeries
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 explicit QPercentBarSeries(QObject *parent = 0);
44 explicit QPercentBarSeries(QObject *parent = Q_NULLPTR);
45 ~QPercentBarSeries();
45 ~QPercentBarSeries();
46 QAbstractSeries::SeriesType type() const;
46 QAbstractSeries::SeriesType type() const;
47
47
@@ -41,7 +41,7 class QT_CHARTS_EXPORT QStackedBarSeries : public QAbstractBarSeries
41 {
41 {
42 Q_OBJECT
42 Q_OBJECT
43 public:
43 public:
44 explicit QStackedBarSeries(QObject *parent = 0);
44 explicit QStackedBarSeries(QObject *parent = Q_NULLPTR);
45 ~QStackedBarSeries();
45 ~QStackedBarSeries();
46 QAbstractSeries::SeriesType type() const;
46 QAbstractSeries::SeriesType type() const;
47
47
@@ -60,6 +60,7 void QBoxPlotModelMapper::setModel(QAbstractItemModel *model)
60 d->m_model = model;
60 d->m_model = model;
61 d->initializeBoxFromModel();
61 d->initializeBoxFromModel();
62 // connect signals from the model
62 // connect signals from the model
63 connect(d->m_model, SIGNAL(modelReset()), d, SLOT(initializeBoxFromModel()));
63 connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
64 connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
64 connect(d->m_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), d, SLOT(modelHeaderDataUpdated(Qt::Orientation,int,int)));
65 connect(d->m_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), d, SLOT(modelHeaderDataUpdated(Qt::Orientation,int,int)));
65 connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
66 connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
@@ -47,7 +47,7 class QT_CHARTS_EXPORT QBoxPlotModelMapper : public QObject
47 Q_OBJECT
47 Q_OBJECT
48
48
49 protected:
49 protected:
50 explicit QBoxPlotModelMapper(QObject *parent = 0);
50 explicit QBoxPlotModelMapper(QObject *parent = Q_NULLPTR);
51
51
52 QAbstractItemModel *model() const;
52 QAbstractItemModel *model() const;
53 void setModel(QAbstractItemModel *model);
53 void setModel(QAbstractItemModel *model);
@@ -47,7 +47,7 class QT_CHARTS_EXPORT QBoxPlotSeries : public QAbstractSeries
47 Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
47 Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged)
48 Q_PROPERTY(int count READ count NOTIFY countChanged REVISION 1)
48 Q_PROPERTY(int count READ count NOTIFY countChanged REVISION 1)
49 public:
49 public:
50 explicit QBoxPlotSeries(QObject *parent = 0);
50 explicit QBoxPlotSeries(QObject *parent = Q_NULLPTR);
51 ~QBoxPlotSeries();
51 ~QBoxPlotSeries();
52
52
53 bool append(QBoxSet *box);
53 bool append(QBoxSet *box);
@@ -54,8 +54,8 public:
54 };
54 };
55
55
56 public:
56 public:
57 explicit QBoxSet(const QString label = QString(), QObject *parent = 0);
57 explicit QBoxSet(const QString label = QString(), QObject *parent = Q_NULLPTR);
58 explicit QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label = QString(), QObject *parent = 0);
58 explicit QBoxSet(const qreal le, const qreal lq, const qreal m, const qreal uq, const qreal ue, const QString label = QString(), QObject *parent = Q_NULLPTR);
59 virtual ~QBoxSet();
59 virtual ~QBoxSet();
60
60
61 void append(const qreal value);
61 void append(const qreal value);
@@ -45,7 +45,7 class QT_CHARTS_EXPORT QVBoxPlotModelMapper : public QBoxPlotModelMapper
45 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
45 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
46
46
47 public:
47 public:
48 explicit QVBoxPlotModelMapper(QObject *parent = 0);
48 explicit QVBoxPlotModelMapper(QObject *parent = Q_NULLPTR);
49
49
50 QAbstractItemModel *model() const;
50 QAbstractItemModel *model() const;
51 void setModel(QAbstractItemModel *model);
51 void setModel(QAbstractItemModel *model);
@@ -60,10 +60,15 QString ChartTitle::text() const
60 void ChartTitle::setGeometry(const QRectF &rect)
60 void ChartTitle::setGeometry(const QRectF &rect)
61 {
61 {
62 QRectF truncatedRect;
62 QRectF truncatedRect;
63 if (m_text.isEmpty()) {
64 QGraphicsTextItem::setHtml(m_text);
65 QGraphicsTextItem::setTextWidth(0.0);
66 } else {
63 QGraphicsTextItem::setHtml(ChartPresenter::truncatedText(font(), m_text, qreal(0.0),
67 QGraphicsTextItem::setHtml(ChartPresenter::truncatedText(font(), m_text, qreal(0.0),
64 rect.width(), rect.height(),
68 rect.width(), rect.height(),
65 truncatedRect));
69 truncatedRect));
66 QGraphicsTextItem::setTextWidth(truncatedRect.width());
70 QGraphicsTextItem::setTextWidth(truncatedRect.width());
71 }
67 setPos(rect.topLeft());
72 setPos(rect.topLeft());
68 }
73 }
69
74
@@ -65,7 +65,7 void AbstractChartLayout::setGeometry(const QRectF &rect)
65
65
66 contentGeometry = calculateContentGeometry(contentGeometry);
66 contentGeometry = calculateContentGeometry(contentGeometry);
67
67
68 if (title && title->isVisible() && !title->text().isEmpty())
68 if (title && title->isVisible())
69 contentGeometry = calculateTitleGeometry(contentGeometry, title);
69 contentGeometry = calculateTitleGeometry(contentGeometry, title);
70
70
71 if (legend->isAttachedToChart() && legend->isVisible())
71 if (legend->isAttachedToChart() && legend->isVisible())
@@ -167,12 +167,16 QRectF AbstractChartLayout::calculateLegendMinimum(const QRectF &geometry, QLege
167 QRectF AbstractChartLayout::calculateTitleGeometry(const QRectF &geometry, ChartTitle *title) const
167 QRectF AbstractChartLayout::calculateTitleGeometry(const QRectF &geometry, ChartTitle *title) const
168 {
168 {
169 title->setGeometry(geometry);
169 title->setGeometry(geometry);
170 if (title->text().isEmpty()) {
171 return geometry;
172 } else {
170 // Round to full pixel via QPoint to avoid one pixel clipping on the edge in some cases
173 // Round to full pixel via QPoint to avoid one pixel clipping on the edge in some cases
171 QPointF center((geometry.center() - title->boundingRect().center()).toPoint());
174 QPointF center((geometry.center() - title->boundingRect().center()).toPoint());
172
175
173 title->setPos(center.x(), title->pos().y());
176 title->setPos(center.x(), title->pos().y());
174 return geometry.adjusted(0, title->boundingRect().height()+1, 0, 0);
177 return geometry.adjusted(0, title->boundingRect().height() + 1, 0, 0);
175 }
178 }
179 }
176
180
177 QRectF AbstractChartLayout::calculateTitleMinimum(const QRectF &minimum, ChartTitle *title) const
181 QRectF AbstractChartLayout::calculateTitleMinimum(const QRectF &minimum, ChartTitle *title) const
178 {
182 {
@@ -43,7 +43,7 class QT_CHARTS_EXPORT QAreaLegendMarker : public QLegendMarker
43 Q_OBJECT
43 Q_OBJECT
44
44
45 public:
45 public:
46 explicit QAreaLegendMarker(QAreaSeries *series, QLegend *legend, QObject *parent = 0);
46 explicit QAreaLegendMarker(QAreaSeries *series, QLegend *legend, QObject *parent = Q_NULLPTR);
47 virtual ~QAreaLegendMarker();
47 virtual ~QAreaLegendMarker();
48
48
49 virtual LegendMarkerType type() { return LegendMarkerTypeArea; }
49 virtual LegendMarkerType type() { return LegendMarkerTypeArea; }
@@ -52,7 +52,7 public:
52 virtual QAreaSeries* series();
52 virtual QAreaSeries* series();
53
53
54 protected:
54 protected:
55 QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *parent = 0);
55 QAreaLegendMarker(QAreaLegendMarkerPrivate &d, QObject *parent = Q_NULLPTR);
56
56
57 private:
57 private:
58 Q_DECLARE_PRIVATE(QAreaLegendMarker)
58 Q_DECLARE_PRIVATE(QAreaLegendMarker)
@@ -43,7 +43,7 class QT_CHARTS_EXPORT QBarLegendMarker : public QLegendMarker
43 {
43 {
44 Q_OBJECT
44 Q_OBJECT
45 public:
45 public:
46 explicit QBarLegendMarker(QAbstractBarSeries *series, QBarSet *barset, QLegend *legend, QObject *parent = 0);
46 explicit QBarLegendMarker(QAbstractBarSeries *series, QBarSet *barset, QLegend *legend, QObject *parent = Q_NULLPTR);
47 virtual ~QBarLegendMarker();
47 virtual ~QBarLegendMarker();
48
48
49 virtual LegendMarkerType type() { return LegendMarkerTypeBar; }
49 virtual LegendMarkerType type() { return LegendMarkerTypeBar; }
@@ -53,7 +53,7 public:
53 QBarSet* barset();
53 QBarSet* barset();
54
54
55 protected:
55 protected:
56 QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent = 0);
56 QBarLegendMarker(QBarLegendMarkerPrivate &d, QObject *parent = Q_NULLPTR);
57
57
58 private:
58 private:
59 Q_DECLARE_PRIVATE(QBarLegendMarker)
59 Q_DECLARE_PRIVATE(QBarLegendMarker)
@@ -43,7 +43,7 class QT_CHARTS_EXPORT QBoxPlotLegendMarker : public QLegendMarker
43 Q_OBJECT
43 Q_OBJECT
44
44
45 public:
45 public:
46 explicit QBoxPlotLegendMarker(QBoxPlotSeries *series, QLegend *legend, QObject *parent = 0);
46 explicit QBoxPlotLegendMarker(QBoxPlotSeries *series, QLegend *legend, QObject *parent = Q_NULLPTR);
47 virtual ~QBoxPlotLegendMarker();
47 virtual ~QBoxPlotLegendMarker();
48
48
49 virtual LegendMarkerType type() { return LegendMarkerTypeBoxPlot; }
49 virtual LegendMarkerType type() { return LegendMarkerTypeBoxPlot; }
@@ -52,7 +52,7 public:
52 virtual QBoxPlotSeries* series();
52 virtual QBoxPlotSeries* series();
53
53
54 protected:
54 protected:
55 QBoxPlotLegendMarker(QBoxPlotLegendMarkerPrivate &d, QObject *parent = 0);
55 QBoxPlotLegendMarker(QBoxPlotLegendMarkerPrivate &d, QObject *parent = Q_NULLPTR);
56
56
57 private:
57 private:
58 Q_DECLARE_PRIVATE(QBoxPlotLegendMarker)
58 Q_DECLARE_PRIVATE(QBoxPlotLegendMarker)
@@ -60,7 +60,7 private:
60 public:
60 public:
61 ~QLegend();
61 ~QLegend();
62
62
63 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
63 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR);
64
64
65 void setBrush(const QBrush &brush);
65 void setBrush(const QBrush &brush);
66 QBrush brush() const;
66 QBrush brush() const;
@@ -90,7 +90,7 public:
90 void setBackgroundVisible(bool visible = true);
90 void setBackgroundVisible(bool visible = true);
91 bool isBackgroundVisible() const;
91 bool isBackgroundVisible() const;
92
92
93 QList <QLegendMarker*> markers(QAbstractSeries *series = 0) const;
93 QList <QLegendMarker*> markers(QAbstractSeries *series = Q_NULLPTR) const;
94
94
95 bool reverseMarkers();
95 bool reverseMarkers();
96 void setReverseMarkers(bool reverseMarkers = true);
96 void setReverseMarkers(bool reverseMarkers = true);
@@ -98,7 +98,7 Q_SIGNALS:
98 void visibleChanged();
98 void visibleChanged();
99
99
100 protected:
100 protected:
101 explicit QLegendMarker(QLegendMarkerPrivate &d, QObject *parent = 0);
101 explicit QLegendMarker(QLegendMarkerPrivate &d, QObject *parent = Q_NULLPTR);
102
102
103 QScopedPointer<QLegendMarkerPrivate> d_ptr;
103 QScopedPointer<QLegendMarkerPrivate> d_ptr;
104 friend class QLegendPrivate;
104 friend class QLegendPrivate;
@@ -44,7 +44,7 class QT_CHARTS_EXPORT QPieLegendMarker : public QLegendMarker
44 Q_OBJECT
44 Q_OBJECT
45
45
46 public:
46 public:
47 explicit QPieLegendMarker(QPieSeries *series, QPieSlice *slice, QLegend *legend, QObject *parent = 0);
47 explicit QPieLegendMarker(QPieSeries *series, QPieSlice *slice, QLegend *legend, QObject *parent = Q_NULLPTR);
48 virtual ~QPieLegendMarker();
48 virtual ~QPieLegendMarker();
49
49
50 virtual LegendMarkerType type() { return LegendMarkerTypePie; }
50 virtual LegendMarkerType type() { return LegendMarkerTypePie; }
@@ -54,7 +54,7 public:
54 QPieSlice* slice();
54 QPieSlice* slice();
55
55
56 protected:
56 protected:
57 QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent = 0);
57 QPieLegendMarker(QPieLegendMarkerPrivate &d, QObject *parent = Q_NULLPTR);
58
58
59 private:
59 private:
60 Q_DECLARE_PRIVATE(QPieLegendMarker)
60 Q_DECLARE_PRIVATE(QPieLegendMarker)
@@ -42,7 +42,7 class QT_CHARTS_EXPORT QXYLegendMarker : public QLegendMarker
42 {
42 {
43 Q_OBJECT
43 Q_OBJECT
44 public:
44 public:
45 explicit QXYLegendMarker(QXYSeries *series, QLegend *legend, QObject *parent = 0);
45 explicit QXYLegendMarker(QXYSeries *series, QLegend *legend, QObject *parent = Q_NULLPTR);
46 virtual ~QXYLegendMarker();
46 virtual ~QXYLegendMarker();
47
47
48 virtual LegendMarkerType type() { return LegendMarkerTypeXY; }
48 virtual LegendMarkerType type() { return LegendMarkerTypeXY; }
@@ -51,7 +51,7 public:
51 virtual QXYSeries* series();
51 virtual QXYSeries* series();
52
52
53 protected:
53 protected:
54 QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent = 0);
54 QXYLegendMarker(QXYLegendMarkerPrivate &d, QObject *parent = Q_NULLPTR);
55
55
56 private:
56 private:
57 Q_DECLARE_PRIVATE(QXYLegendMarker)
57 Q_DECLARE_PRIVATE(QXYLegendMarker)
@@ -43,12 +43,12 class QT_CHARTS_EXPORT QLineSeries : public QXYSeries
43 Q_OBJECT
43 Q_OBJECT
44
44
45 public:
45 public:
46 explicit QLineSeries(QObject *parent = 0);
46 explicit QLineSeries(QObject *parent = Q_NULLPTR);
47 ~QLineSeries();
47 ~QLineSeries();
48 QAbstractSeries::SeriesType type() const;
48 QAbstractSeries::SeriesType type() const;
49
49
50 protected:
50 protected:
51 QLineSeries(QLineSeriesPrivate &d, QObject *parent = 0);
51 QLineSeries(QLineSeriesPrivate &d, QObject *parent = Q_NULLPTR);
52
52
53 private:
53 private:
54 Q_DECLARE_PRIVATE(QLineSeries)
54 Q_DECLARE_PRIVATE(QLineSeries)
@@ -45,7 +45,7 class QT_CHARTS_EXPORT QHPieModelMapper : public QPieModelMapper
45 Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
45 Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
46
46
47 public:
47 public:
48 explicit QHPieModelMapper(QObject *parent = 0);
48 explicit QHPieModelMapper(QObject *parent = Q_NULLPTR);
49
49
50 QAbstractItemModel *model() const;
50 QAbstractItemModel *model() const;
51 void setModel(QAbstractItemModel *model);
51 void setModel(QAbstractItemModel *model);
@@ -60,6 +60,7 void QPieModelMapper::setModel(QAbstractItemModel *model)
60 d->m_model = model;
60 d->m_model = model;
61 d->initializePieFromModel();
61 d->initializePieFromModel();
62 // connect signals from the model
62 // connect signals from the model
63 connect(d->m_model, SIGNAL(modelReset()), d, SLOT(initializePieFromModel()));
63 connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
64 connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), d, SLOT(modelUpdated(QModelIndex,QModelIndex)));
64 connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
65 connect(d->m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), d, SLOT(modelRowsAdded(QModelIndex,int,int)));
65 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
66 connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), d, SLOT(modelRowsRemoved(QModelIndex,int,int)));
@@ -47,7 +47,7 class QT_CHARTS_EXPORT QPieModelMapper : public QObject
47 Q_OBJECT
47 Q_OBJECT
48
48
49 protected:
49 protected:
50 explicit QPieModelMapper(QObject *parent = 0);
50 explicit QPieModelMapper(QObject *parent = Q_NULLPTR);
51
51
52 QAbstractItemModel *model() const;
52 QAbstractItemModel *model() const;
53 void setModel(QAbstractItemModel *model);
53 void setModel(QAbstractItemModel *model);
@@ -49,7 +49,7 class QT_CHARTS_EXPORT QPieSeries : public QAbstractSeries
49 Q_PROPERTY(qreal holeSize READ holeSize WRITE setHoleSize)
49 Q_PROPERTY(qreal holeSize READ holeSize WRITE setHoleSize)
50
50
51 public:
51 public:
52 explicit QPieSeries(QObject *parent = 0);
52 explicit QPieSeries(QObject *parent = Q_NULLPTR);
53 virtual ~QPieSeries();
53 virtual ~QPieSeries();
54
54
55 QAbstractSeries::SeriesType type() const;
55 QAbstractSeries::SeriesType type() const;
@@ -72,8 +72,8 public:
72 };
72 };
73
73
74 public:
74 public:
75 explicit QPieSlice(QObject *parent = 0);
75 explicit QPieSlice(QObject *parent = Q_NULLPTR);
76 QPieSlice(QString label, qreal value, QObject *parent = 0);
76 QPieSlice(QString label, qreal value, QObject *parent = Q_NULLPTR);
77 virtual ~QPieSlice();
77 virtual ~QPieSlice();
78
78
79 void setLabel(QString label);
79 void setLabel(QString label);
@@ -45,7 +45,7 class QT_CHARTS_EXPORT QVPieModelMapper : public QPieModelMapper
45 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
45 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
46
46
47 public:
47 public:
48 explicit QVPieModelMapper(QObject *parent = 0);
48 explicit QVPieModelMapper(QObject *parent = Q_NULLPTR);
49
49
50 QAbstractItemModel *model() const;
50 QAbstractItemModel *model() const;
51 void setModel(QAbstractItemModel *model);
51 void setModel(QAbstractItemModel *model);
@@ -67,7 +67,7 public:
67 };
67 };
68
68
69 protected:
69 protected:
70 QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent = 0);
70 QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent = Q_NULLPTR);
71
71
72 public:
72 public:
73 ~QAbstractSeries();
73 ~QAbstractSeries();
@@ -96,7 +96,7 public:
96 Q_DECLARE_FLAGS(AnimationOptions, AnimationOption)
96 Q_DECLARE_FLAGS(AnimationOptions, AnimationOption)
97
97
98 public:
98 public:
99 explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
99 explicit QChart(QGraphicsItem *parent = Q_NULLPTR, Qt::WindowFlags wFlags = Qt::WindowFlags());
100 ~QChart();
100 ~QChart();
101
101
102 void addSeries(QAbstractSeries *series);
102 void addSeries(QAbstractSeries *series);
@@ -105,15 +105,15 public:
105 QList<QAbstractSeries *> series() const;
105 QList<QAbstractSeries *> series() const;
106
106
107 // *** deprecated ***
107 // *** deprecated ***
108 void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0);
108 void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = Q_NULLPTR);
109 void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0);
109 void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = Q_NULLPTR);
110 QAbstractAxis *axisX(QAbstractSeries *series = 0) const;
110 QAbstractAxis *axisX(QAbstractSeries *series = Q_NULLPTR) const;
111 QAbstractAxis *axisY(QAbstractSeries *series = 0) const;
111 QAbstractAxis *axisY(QAbstractSeries *series = Q_NULLPTR) const;
112 // ******************
112 // ******************
113
113
114 void addAxis(QAbstractAxis *axis, Qt::Alignment alignment);
114 void addAxis(QAbstractAxis *axis, Qt::Alignment alignment);
115 void removeAxis(QAbstractAxis *axis);
115 void removeAxis(QAbstractAxis *axis);
116 QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const;
116 QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = Q_NULLPTR) const;
117
117
118 void createDefaultAxes();
118 void createDefaultAxes();
119
119
@@ -173,8 +173,8 public:
173 void setLocale(const QLocale &locale);
173 void setLocale(const QLocale &locale);
174 QLocale locale() const;
174 QLocale locale() const;
175
175
176 QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0);
176 QPointF mapToValue(const QPointF &position, QAbstractSeries *series = Q_NULLPTR);
177 QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0);
177 QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = Q_NULLPTR);
178
178
179 ChartType chartType() const;
179 ChartType chartType() const;
180
180
@@ -59,8 +59,8 public:
59
59
60 Q_DECLARE_FLAGS(RubberBands, RubberBand)
60 Q_DECLARE_FLAGS(RubberBands, RubberBand)
61
61
62 explicit QChartView(QWidget *parent = 0);
62 explicit QChartView(QWidget *parent = Q_NULLPTR);
63 explicit QChartView(QChart *chart, QWidget *parent = 0);
63 explicit QChartView(QChart *chart, QWidget *parent = Q_NULLPTR);
64 ~QChartView();
64 ~QChartView();
65
65
66 void setRubberBand(const RubberBands &rubberBands);
66 void setRubberBand(const RubberBands &rubberBands);
@@ -51,12 +51,12 public:
51 Q_DECLARE_FLAGS(PolarOrientations, PolarOrientation)
51 Q_DECLARE_FLAGS(PolarOrientations, PolarOrientation)
52
52
53 public:
53 public:
54 explicit QPolarChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
54 explicit QPolarChart(QGraphicsItem *parent = Q_NULLPTR, Qt::WindowFlags wFlags = Qt::WindowFlags());
55 ~QPolarChart();
55 ~QPolarChart();
56
56
57 void addAxis(QAbstractAxis *axis, PolarOrientation polarOrientation);
57 void addAxis(QAbstractAxis *axis, PolarOrientation polarOrientation);
58
58
59 QList<QAbstractAxis*> axes(PolarOrientations polarOrientation = PolarOrientations(PolarOrientationRadial | PolarOrientationAngular), QAbstractSeries *series = 0) const;
59 QList<QAbstractAxis*> axes(PolarOrientations polarOrientation = PolarOrientations(PolarOrientationRadial | PolarOrientationAngular), QAbstractSeries *series = Q_NULLPTR) const;
60
60
61 static PolarOrientation axisPolarOrientation(QAbstractAxis *axis);
61 static PolarOrientation axisPolarOrientation(QAbstractAxis *axis);
62
62
@@ -54,7 +54,7 public:
54 };
54 };
55
55
56 public:
56 public:
57 explicit QScatterSeries(QObject *parent = 0);
57 explicit QScatterSeries(QObject *parent = Q_NULLPTR);
58 ~QScatterSeries();
58 ~QScatterSeries();
59 QAbstractSeries::SeriesType type() const;
59 QAbstractSeries::SeriesType type() const;
60 void setPen(const QPen &pen);
60 void setPen(const QPen &pen);
@@ -45,7 +45,7 class QT_CHARTS_EXPORT QSplineSeries : public QLineSeries
45 Q_OBJECT
45 Q_OBJECT
46
46
47 public:
47 public:
48 explicit QSplineSeries(QObject *parent = 0);
48 explicit QSplineSeries(QObject *parent = Q_NULLPTR);
49 ~QSplineSeries();
49 ~QSplineSeries();
50 QAbstractSeries::SeriesType type() const;
50 QAbstractSeries::SeriesType type() const;
51
51
@@ -45,7 +45,7 class QT_CHARTS_EXPORT QHXYModelMapper : public QXYModelMapper
45 Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
45 Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount NOTIFY columnCountChanged)
46
46
47 public:
47 public:
48 explicit QHXYModelMapper(QObject *parent = 0);
48 explicit QHXYModelMapper(QObject *parent = Q_NULLPTR);
49
49
50 QAbstractItemModel *model() const;
50 QAbstractItemModel *model() const;
51 void setModel(QAbstractItemModel *model);
51 void setModel(QAbstractItemModel *model);
@@ -45,7 +45,7 class QT_CHARTS_EXPORT QVXYModelMapper : public QXYModelMapper
45 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
45 Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount NOTIFY rowCountChanged)
46
46
47 public:
47 public:
48 explicit QVXYModelMapper(QObject *parent = 0);
48 explicit QVXYModelMapper(QObject *parent = Q_NULLPTR);
49
49
50 QAbstractItemModel *model() const;
50 QAbstractItemModel *model() const;
51 void setModel(QAbstractItemModel *model);
51 void setModel(QAbstractItemModel *model);
@@ -47,7 +47,7 class QT_CHARTS_EXPORT QXYModelMapper : public QObject
47 Q_OBJECT
47 Q_OBJECT
48
48
49 protected:
49 protected:
50 explicit QXYModelMapper(QObject *parent = 0);
50 explicit QXYModelMapper(QObject *parent = Q_NULLPTR);
51
51
52 QAbstractItemModel *model() const;
52 QAbstractItemModel *model() const;
53 void setModel(QAbstractItemModel *model);
53 void setModel(QAbstractItemModel *model);
@@ -56,7 +56,7 class QT_CHARTS_EXPORT QXYSeries : public QAbstractSeries
56 Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged)
56 Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged)
57
57
58 protected:
58 protected:
59 explicit QXYSeries(QXYSeriesPrivate &d, QObject *parent = 0);
59 explicit QXYSeries(QXYSeriesPrivate &d, QObject *parent = Q_NULLPTR);
60
60
61 public:
61 public:
62 ~QXYSeries();
62 ~QXYSeries();
@@ -77,7 +77,7 void DeclarativeBarSet::setValues(QVariantList values)
77 while (count())
77 while (count())
78 remove(count() - 1);
78 remove(count() - 1);
79
79
80 if (values.at(0).canConvert(QVariant::Point)) {
80 if (values.count() > 0 && values.at(0).canConvert(QVariant::Point)) {
81 // Create list of values for appending if the first item is Qt.point
81 // Create list of values for appending if the first item is Qt.point
82 int maxValue = 0;
82 int maxValue = 0;
83 for (int i = 0; i < values.count(); i++) {
83 for (int i = 0; i < values.count(); i++) {
@@ -520,14 +520,16 QSGNode *DeclarativeChart::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdateP
520
520
521 if (!node) {
521 if (!node) {
522 node = new DeclarativeChartNode(window());
522 node = new DeclarativeChartNode(window());
523 if (node->glRenderNode()) {
523 connect(window(), &QQuickWindow::beforeRendering,
524 connect(window(), &QQuickWindow::beforeRendering,
524 node->glRenderNode(), &DeclarativeRenderNode::render);
525 node->glRenderNode(), &DeclarativeRenderNode::render);
525 }
526 }
527 }
526
528
527 const QRectF &bRect = boundingRect();
529 const QRectF &bRect = boundingRect();
528
530
529 // Update GL data
531 // Update GL data
530 if (m_glXYDataManager->dataMap().size() || m_glXYDataManager->mapDirty()) {
532 if (node->glRenderNode() && (m_glXYDataManager->dataMap().size() || m_glXYDataManager->mapDirty())) {
531 const QRectF &plotArea = m_chart->plotArea();
533 const QRectF &plotArea = m_chart->plotArea();
532 const QSizeF &chartAreaSize = m_chart->size();
534 const QSizeF &chartAreaSize = m_chart->size();
533
535
@@ -47,28 +47,28 DeclarativeChartNode::DeclarativeChartNode(QQuickWindow *window) :
47 m_textureSize(1, 1),
47 m_textureSize(1, 1),
48 m_glRenderNode(0)
48 m_glRenderNode(0)
49 {
49 {
50 initializeOpenGLFunctions();
51
52 // Our texture node must have a texture, so use a default one pixel texture
50 // Our texture node must have a texture, so use a default one pixel texture
53 GLuint defaultTexture = 0;
51 QImage dummyImage(QSize(1, 1), QImage::Format_ARGB32);
54 glGenTextures(1, &defaultTexture);
52 uchar *imageData = dummyImage.bits();
55 glBindTexture(GL_TEXTURE_2D, defaultTexture);
53 imageData[0] = 0;
56 uchar buf[4] = { 0, 0, 0, 0 };
54 imageData[1] = 0;
57 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &buf);
55 imageData[2] = 0;
58
56 imageData[3] = 0;
59 QQuickWindow::CreateTextureOptions defaultTextureOptions = QQuickWindow::CreateTextureOptions(
57 QQuickWindow::CreateTextureOptions defaultTextureOptions = QQuickWindow::CreateTextureOptions(
60 QQuickWindow::TextureHasAlphaChannel | QQuickWindow::TextureOwnsGLTexture);
58 QQuickWindow::TextureHasAlphaChannel | QQuickWindow::TextureOwnsGLTexture);
61 m_texture = m_window->createTextureFromId(defaultTexture, QSize(1, 1), defaultTextureOptions);
59 m_texture = m_window->createTextureFromImage(dummyImage, defaultTextureOptions);
62
60
63 setTexture(m_texture);
61 setTexture(m_texture);
64 setFiltering(QSGTexture::Linear);
62 setFiltering(QSGTexture::Linear);
65
63
64 if (QOpenGLContext::currentContext()) {
66 // Create child node for rendering GL graphics
65 // Create child node for rendering GL graphics
67 m_glRenderNode = new DeclarativeRenderNode(m_window);
66 m_glRenderNode = new DeclarativeRenderNode(m_window);
68 m_glRenderNode->setFlag(OwnedByParent);
67 m_glRenderNode->setFlag(OwnedByParent);
69 appendChildNode(m_glRenderNode);
68 appendChildNode(m_glRenderNode);
70 m_glRenderNode->setRect(0, 0, 0, 0); // Hide child node by default
69 m_glRenderNode->setRect(0, 0, 0, 0); // Hide child node by default
71 }
70 }
71 }
72
72
73 DeclarativeChartNode::~DeclarativeChartNode()
73 DeclarativeChartNode::~DeclarativeChartNode()
74 {
74 {
@@ -216,9 +216,9 QList<RealList> MainWidget::generateTestData(int columnCount, int rowCount, QStr
216 QList <qreal> newColumn;
216 QList <qreal> newColumn;
217 for (int i(0); i < rowCount; i++) {
217 for (int i(0); i < rowCount; i++) {
218 if (dataCharacteristics == "Sin") {
218 if (dataCharacteristics == "Sin") {
219 newColumn.append(abs(sin(3.14159265358979 / 50 * i) * 100));
219 newColumn.append(std::abs(sin(3.14159265358979 / 50 * i) * 100));
220 } else if (dataCharacteristics == "Sin + random") {
220 } else if (dataCharacteristics == "Sin + random") {
221 newColumn.append(abs(sin(3.14159265358979 / 50 * i) * 100) + (rand() % 5));
221 newColumn.append(std::abs(sin(3.14159265358979 / 50 * i) * 100) + (rand() % 5));
222 } else if (dataCharacteristics == "Random") {
222 } else if (dataCharacteristics == "Random") {
223 newColumn.append(rand() % 10 + (qreal) rand() / (qreal) RAND_MAX);
223 newColumn.append(rand() % 10 + (qreal) rand() / (qreal) RAND_MAX);
224 } else if (dataCharacteristics == "Linear") {
224 } else if (dataCharacteristics == "Linear") {
General Comments 0
You need to be logged in to leave comments. Login now