From 1ec42cbed063934fbb7e4bc4de817409cb5256d2 2012-04-10 13:12:34 From: Michal Klocek Date: 2012-04-10 13:12:34 Subject: [PATCH] Adds pimpl for qchartaxis and qchartaxiscategories --- diff --git a/src/axis/axis.cpp b/src/axis/axis.cpp index b69aa1d..06e2e1f 100644 --- a/src/axis/axis.cpp +++ b/src/axis/axis.cpp @@ -20,6 +20,8 @@ #include "axis_p.h" #include "qchartaxis.h" +#include "qchartaxis_p.h" +#include "qchartaxiscategories_p.h" #include "chartpresenter_p.h" #include "chartanimator_p.h" #include @@ -48,8 +50,8 @@ Axis::Axis(QChartAxis *axis,ChartPresenter *presenter,AxisType type) : Chart(pre m_shades->setZValue(ChartPresenter::ShadesZValue); m_grid->setZValue(ChartPresenter::GridZValue); - connect(m_chartAxis,SIGNAL(updated()),this,SLOT(handleAxisUpdated())); - connect(m_chartAxis->categories(),SIGNAL(updated()),this,SLOT(handleAxisCategoriesUpdated())); + QObject::connect(m_chartAxis->d_ptr.data(),SIGNAL(updated()),this,SLOT(handleAxisUpdated())); + QObject::connect(m_chartAxis->categories()->d_ptr.data(),SIGNAL(updated()),this,SLOT(handleAxisCategoriesUpdated())); handleAxisUpdated(); } @@ -455,10 +457,9 @@ void Axis::handleGeometryChanged(const QRectF &rect) void Axis::axisSelected() { - qDebug()<<"TODO axis clicked"; + qDebug()<<"TODO: axis clicked"; } -//TODO "nice numbers algorithm" #include "moc_axis_p.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/axis.pri b/src/axis/axis.pri index 68175cf..4a7637b 100644 --- a/src/axis/axis.pri +++ b/src/axis/axis.pri @@ -7,7 +7,9 @@ SOURCES += \ $$PWD/qchartaxiscategories.cpp PRIVATE_HEADERS += \ - $$PWD/axis_p.h + $$PWD/axis_p.h \ + $$PWD/qchartaxis_p.h \ + $$PWD/qchartaxiscategories_p.h PUBLIC_HEADERS += \ $$PWD/qchartaxis.h \ diff --git a/src/axis/qchartaxis.cpp b/src/axis/qchartaxis.cpp index b67b121..d7ab2fb 100644 --- a/src/axis/qchartaxis.cpp +++ b/src/axis/qchartaxis.cpp @@ -19,6 +19,7 @@ ****************************************************************************/ #include "qchartaxis.h" +#include "qchartaxis_p.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -178,16 +179,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ QChartAxis::QChartAxis(QObject *parent) : QObject(parent), - m_axisVisible(true), - m_gridLineVisible(true), - m_labelsVisible(true), - m_labelsAngle(0), - m_shadesVisible(false), - m_shadesOpacity(1.0), - m_min(0), - m_max(0), - m_ticksCount(5), - m_niceNumbers(false) +d_ptr(new QChartAxisPrivate(this)) { } @@ -205,150 +197,218 @@ QChartAxis::~QChartAxis() */ void QChartAxis::setAxisPen(const QPen &pen) { - if (pen != m_axisPen) { - m_axisPen = pen; - emit updated(); + if (d_ptr->m_axisPen!=pen) { + d_ptr->m_axisPen = pen; + emit d_ptr->updated(); } } +QPen QChartAxis::axisPen() const +{ + return d_ptr->m_axisPen; +} + /*! Sets if axis and ticks are \a visible. */ void QChartAxis::setAxisVisible(bool visible) { - if (m_axisVisible != visible) { - m_axisVisible = visible; - emit updated(); + if (d_ptr->m_axisVisible != visible) { + d_ptr->m_axisVisible = visible; + emit d_ptr->updated(); } } +bool QChartAxis::isAxisVisible() const +{ + return d_ptr->m_axisVisible; +} + /*! Sets if grid line is \a visible. */ void QChartAxis::setGridLineVisible(bool visible) { - if (m_gridLineVisible != visible) { - m_gridLineVisible = visible; - emit updated(); + if (d_ptr->m_gridLineVisible != visible) { + d_ptr->m_gridLineVisible = visible; + emit d_ptr->updated(); } } +bool QChartAxis::isGridLineVisible() const +{ + return d_ptr->m_gridLineVisible; +} /*! Sets \a pen used to draw grid line. */ void QChartAxis::setGridLinePen(const QPen &pen) { - if (m_gridLinePen != pen) { - m_gridLinePen = pen; - emit updated(); + if (d_ptr->m_gridLinePen != pen) { + d_ptr->m_gridLinePen = pen; + emit d_ptr->updated(); } } +QPen QChartAxis::gridLinePen() const +{ + return d_ptr->m_gridLinePen; +} + /*! Sets if axis' labels are \a visible. */ void QChartAxis::setLabelsVisible(bool visible) { - if (m_labelsVisible != visible) { - m_labelsVisible = visible; - emit updated(); + if (d_ptr->m_labelsVisible != visible) { + d_ptr->m_labelsVisible = visible; + emit d_ptr->updated(); } } +bool QChartAxis::labelsVisible() const +{ + return d_ptr->m_labelsVisible; +} /*! Sets \a pen used to draw labels. */ void QChartAxis::setLabelsPen(const QPen &pen) { - if (m_labelsPen != pen) { - m_labelsPen = pen; - emit updated(); + if (d_ptr->m_labelsPen != pen) { + d_ptr->m_labelsPen = pen; + emit d_ptr->updated(); } } +QPen QChartAxis::labelsPen() const +{ + return d_ptr->m_labelsPen; +} + /*! Sets \a brush used to draw labels. */ void QChartAxis::setLabelsBrush(const QBrush &brush) { - if (m_labelsBrush != brush) { - m_labelsBrush = brush; - emit updated(); + if (d_ptr->m_labelsBrush != brush) { + d_ptr->m_labelsBrush = brush; + emit d_ptr->updated(); } } +QBrush QChartAxis::labelsBrush() const +{ + return d_ptr->m_labelsBrush; +} + /*! Sets \a font used to draw labels. */ void QChartAxis::setLabelsFont(const QFont &font) { - if (m_labelsFont != font) { - m_labelsFont = font; - emit updated(); + if (d_ptr->m_labelsFont != font) { + d_ptr->m_labelsFont = font; + emit d_ptr->updated(); } } +QFont QChartAxis::labelsFont() const +{ + return d_ptr->m_labelsFont; +} + /*! Sets \a angle for all the labels on given axis. */ void QChartAxis::setLabelsAngle(int angle) { - if (m_labelsAngle != angle) { - m_labelsAngle = angle; - emit updated(); + if (d_ptr->m_labelsAngle != angle) { + d_ptr->m_labelsAngle = angle; + emit d_ptr->updated(); } } +int QChartAxis::labelsAngle() const +{ + return d_ptr->m_labelsAngle; +} + /*! Sets if shades are \a visible. */ void QChartAxis::setShadesVisible(bool visible) { - if (m_shadesVisible != visible) { - m_shadesVisible = visible; - emit updated(); + if (d_ptr->m_shadesVisible != visible) { + d_ptr->m_shadesVisible = visible; + emit d_ptr->updated(); } } +bool QChartAxis::shadesVisible() const +{ + return d_ptr->m_shadesVisible; +} + /*! Sets \a pen used to draw shades. */ void QChartAxis::setShadesPen(const QPen &pen) { - if (m_shadesPen != pen) { - m_shadesPen = pen; - emit updated(); + if (d_ptr->m_shadesPen != pen) { + d_ptr->m_shadesPen = pen; + emit d_ptr->updated(); } } +QPen QChartAxis::shadesPen() const +{ + return d_ptr->m_shadesPen; +} + /*! Sets \a brush used to draw shades. */ void QChartAxis::setShadesBrush(const QBrush &brush) { - if (m_shadesBrush != brush) { - m_shadesBrush = brush; - emit updated(); + if (d_ptr->m_shadesBrush != brush) { + d_ptr->m_shadesBrush = brush; + emit d_ptr->updated(); } } +QBrush QChartAxis::shadesBrush() const +{ + return d_ptr->m_shadesBrush; +} + /*! Sets \a opacity of the shades. */ void QChartAxis::setShadesOpacity(qreal opacity) { - if (m_shadesOpacity != opacity) { - m_shadesOpacity=opacity; - emit updated(); + if (d_ptr->m_shadesOpacity != opacity) { + d_ptr->m_shadesOpacity=opacity; + emit d_ptr->updated(); } } +qreal QChartAxis::shadesOpacity() const +{ + return d_ptr->m_shadesOpacity; +} + /*! Sets \a min value on the axis. */ void QChartAxis::setMin(qreal min) { - setRange(min,m_max); + setRange(min,d_ptr->m_max); +} + +qreal QChartAxis::min() const +{ + return d_ptr->m_min; } /*! @@ -356,7 +416,12 @@ void QChartAxis::setMin(qreal min) */ void QChartAxis::setMax(qreal max) { - setRange(m_min,max); + setRange(d_ptr->m_min,max); +} + +qreal QChartAxis::max() const +{ + return d_ptr->m_max; } /*! @@ -365,21 +430,21 @@ void QChartAxis::setMax(qreal max) void QChartAxis::setRange(qreal min, qreal max) { bool changed = false; - if (!qFuzzyIsNull(m_min - min)) { - m_min = min; + if (!qFuzzyIsNull(d_ptr->m_min - min)) { + d_ptr->m_min = min; changed = true; emit minChanged(min); } - if (!qFuzzyIsNull(m_max - max)) { - m_max = max; + if (!qFuzzyIsNull(d_ptr->m_max - max)) { + d_ptr->m_max = max; changed = true; emit maxChanged(max); } if (changed) { - emit rangeChanged(m_min,m_max); - emit this->changed(m_min, m_max, m_ticksCount, m_niceNumbers); + emit rangeChanged(d_ptr->m_min,d_ptr->m_max); + emit d_ptr->changed(d_ptr->m_min, d_ptr->m_max, d_ptr->m_ticksCount, d_ptr->m_niceNumbers); } } @@ -388,23 +453,28 @@ void QChartAxis::setRange(qreal min, qreal max) */ void QChartAxis::setTicksCount(int count) { - if (m_ticksCount != count) { - m_ticksCount = count; + if (d_ptr->m_ticksCount != count) { + d_ptr->m_ticksCount = count; emit ticksCountChanged(count); - emit changed(m_min, m_max, m_ticksCount, m_niceNumbers); + emit d_ptr->changed(d_ptr->m_min, d_ptr->m_max, d_ptr->m_ticksCount, d_ptr->m_niceNumbers); } } +int QChartAxis::ticksCount() const +{ + return d_ptr->m_ticksCount; +} + /*! Sets axis, shades, labels and grid lines to be visible. */ void QChartAxis::show() { - m_axisVisible=true; - m_gridLineVisible=true; - m_labelsVisible=true; - m_shadesVisible=true; - emit updated(); + d_ptr->m_axisVisible=true; + d_ptr->m_gridLineVisible=true; + d_ptr->m_labelsVisible=true; + d_ptr->m_shadesVisible=true; + emit d_ptr->updated(); } /*! @@ -412,20 +482,11 @@ void QChartAxis::show() */ void QChartAxis::hide() { - m_axisVisible = false; - m_gridLineVisible = false; - m_labelsVisible = false; - m_shadesVisible = false; - emit updated(); -} - -/*! - \internal - */ -void QChartAxis::handleAxisRangeChanged(qreal min, qreal max,int count) -{ - setRange(min,max); - setTicksCount(count); + d_ptr->m_axisVisible = false; + d_ptr->m_gridLineVisible = false; + d_ptr->m_labelsVisible = false; + d_ptr->m_shadesVisible = false; + emit d_ptr->updated(); } /*! @@ -433,12 +494,52 @@ void QChartAxis::handleAxisRangeChanged(qreal min, qreal max,int count) */ void QChartAxis::setNiceNumbers(bool enable) { - if (m_niceNumbers != enable){ - m_niceNumbers = enable; - emit changed(m_min, m_max, m_ticksCount, m_niceNumbers); + if (d_ptr->m_niceNumbers != enable){ + d_ptr->m_niceNumbers = enable; + emit d_ptr->changed(d_ptr->m_min, d_ptr->m_max, d_ptr->m_ticksCount, d_ptr->m_niceNumbers); } } +bool QChartAxis::niceNumbers() const +{ + return d_ptr->m_niceNumbers; +} + +QChartAxisCategories* QChartAxis::categories() +{ + return &d_ptr->m_category; +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +QChartAxisPrivate::QChartAxisPrivate(QChartAxis* q): +q_ptr(q), +m_axisVisible(true), +m_gridLineVisible(true), +m_labelsVisible(true), +m_labelsAngle(0), +m_shadesVisible(false), +m_shadesOpacity(1.0), +m_min(0), +m_max(0), +m_ticksCount(5), +m_niceNumbers(false) +{ + +} + +QChartAxisPrivate::~QChartAxisPrivate() +{ + +} + +void QChartAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) +{ + q_ptr->setRange(min,max); + q_ptr->setTicksCount(count); +} + #include "moc_qchartaxis.cpp" +#include "moc_qchartaxis_p.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/qchartaxis.h b/src/axis/qchartaxis.h index fa65465..810fac5 100644 --- a/src/axis/qchartaxis.h +++ b/src/axis/qchartaxis.h @@ -28,6 +28,8 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE +class QChartAxisPrivate; + class QTCOMMERCIALCHART_EXPORT QChartAxis : public QObject { Q_OBJECT @@ -37,54 +39,54 @@ public: ~QChartAxis(); //axis handling - bool isAxisVisible() const { return m_axisVisible; } + bool isAxisVisible() const; void setAxisVisible(bool visible); void setAxisPen(const QPen &pen); - QPen axisPen() const { return m_axisPen; } + QPen axisPen() const; //grid handling - bool isGridLineVisible() const { return m_gridLineVisible; } + bool isGridLineVisible() const; void setGridLineVisible(bool visible); void setGridLinePen(const QPen &pen); - QPen gridLinePen() const { return m_gridLinePen; } + QPen gridLinePen() const; //labels handling - bool labelsVisible() const { return m_labelsVisible; } + bool labelsVisible() const; void setLabelsVisible(bool visible); void setLabelsPen(const QPen &pen); - QPen labelsPen() const { return m_labelsPen;} + QPen labelsPen() const; void setLabelsBrush(const QBrush &brush); - QBrush labelsBrush() const { return m_labelsBrush; } + QBrush labelsBrush() const; void setLabelsFont(const QFont &font); - QFont labelsFont() const { return m_labelsFont; } + QFont labelsFont() const; void setLabelsAngle(int angle); - int labelsAngle() const { return m_labelsAngle; } + int labelsAngle() const; //shades handling - bool shadesVisible() const { return m_shadesVisible; } + bool shadesVisible() const; void setShadesVisible(bool visible); void setShadesPen(const QPen &pen); - QPen shadesPen() const { return m_shadesPen; } + QPen shadesPen() const; void setShadesBrush(const QBrush &brush); - QBrush shadesBrush() const { return m_shadesBrush; } + QBrush shadesBrush() const; void setShadesOpacity(qreal opacity); - qreal shadesOpacity() const { return m_shadesOpacity; } + qreal shadesOpacity() const; //range handling void setMin(qreal min); - qreal min() const { return m_min; } + qreal min() const; void setMax(qreal max); - qreal max() const { return m_max; } + qreal max() const; void setRange(qreal min, qreal max); //ticks handling void setTicksCount(int count); - int ticksCount() const { return m_ticksCount;} + int ticksCount() const; void setNiceNumbers(bool enable); - bool niceNumbers() const { return m_niceNumbers;} + bool niceNumbers() const; - QChartAxisCategories* categories() { return &m_category; } + QChartAxisCategories* categories(); void show(); void hide(); @@ -95,39 +97,11 @@ Q_SIGNALS: void rangeChanged(qreal min, qreal max); void ticksCountChanged(int count); -//interal signal - void updated(); - void changed(qreal min, qreal max, int tickCount,bool niceNumbers); -//internal slot -public Q_SLOTS: - void handleAxisRangeChanged(qreal min, qreal max,int count); - private: - bool m_axisVisible; - QPen m_axisPen; - QBrush m_axisBrush; - - bool m_gridLineVisible; - QPen m_gridLinePen; - - bool m_labelsVisible; - QPen m_labelsPen; - QBrush m_labelsBrush; - QFont m_labelsFont; - int m_labelsAngle; - - bool m_shadesVisible; - QPen m_shadesPen; - QBrush m_shadesBrush; - qreal m_shadesOpacity; - - qreal m_min; - qreal m_max; - - int m_ticksCount; - QChartAxisCategories m_category; - - bool m_niceNumbers; + QScopedPointer d_ptr; + Q_DISABLE_COPY(QChartAxis); + friend class ChartDataSet; + friend class Axis; }; QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/qchartaxis_p.h b/src/axis/qchartaxis_p.h new file mode 100644 index 0000000..dc42859 --- /dev/null +++ b/src/axis/qchartaxis_p.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the QtCommercial Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef QCHARTAXIS_P_H_ +#define QCHARTAXIS_P_H_ + +#include "qchartaxis.h" + +QTCOMMERCIALCHART_BEGIN_NAMESPACE + +class QChartAxisPrivate : public QObject +{ + Q_OBJECT +public: + QChartAxisPrivate(QChartAxis *q); + ~QChartAxisPrivate(); + +Q_SIGNALS: + void updated(); + void changed(qreal min, qreal max, int tickCount,bool niceNumbers); + +public Q_SLOTS: + void handleAxisRangeChanged(qreal min, qreal max,int count); + +private: + QChartAxis *q_ptr; + + bool m_axisVisible; + QPen m_axisPen; + QBrush m_axisBrush; + + bool m_gridLineVisible; + QPen m_gridLinePen; + + bool m_labelsVisible; + QPen m_labelsPen; + QBrush m_labelsBrush; + QFont m_labelsFont; + int m_labelsAngle; + + bool m_shadesVisible; + QPen m_shadesPen; + QBrush m_shadesBrush; + qreal m_shadesOpacity; + + qreal m_min; + qreal m_max; + + int m_ticksCount; + QChartAxisCategories m_category; + + bool m_niceNumbers; + + friend class QChartAxis; +}; + +QTCOMMERCIALCHART_END_NAMESPACE + +#endif diff --git a/src/axis/qchartaxiscategories.cpp b/src/axis/qchartaxiscategories.cpp index 5941a8f..5815ebc 100644 --- a/src/axis/qchartaxiscategories.cpp +++ b/src/axis/qchartaxiscategories.cpp @@ -19,63 +19,78 @@ ****************************************************************************/ #include "qchartaxiscategories.h" +#include "qchartaxiscategories_p.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE -QChartAxisCategories::QChartAxisCategories() +QChartAxisCategories::QChartAxisCategories(): +d_ptr(new QChartAxisCategoriesPrivate(this)) { - // TODO Auto-generated constructor stub } QChartAxisCategories::~QChartAxisCategories() { - // TODO Auto-generated destructor stub + } void QChartAxisCategories::insert(const QBarCategories &categories) { int i=1; foreach (QString string , categories) { - m_map.insert(i,string); + d_ptr->m_map.insert(i,string); i++; } - emit updated(); + emit d_ptr->updated(); } void QChartAxisCategories::insert(qreal value,QString label) { - m_map.insert(value,label); - emit updated(); + d_ptr->m_map.insert(value,label); + emit d_ptr->updated(); } void QChartAxisCategories::remove(qreal value) { - m_map.remove(value); - emit updated(); + d_ptr->m_map.remove(value); + emit d_ptr->updated(); } void QChartAxisCategories::clear() { - m_map.clear(); - emit updated(); + d_ptr->m_map.clear(); + emit d_ptr->updated(); } int QChartAxisCategories::count() { - return m_map.count(); + return d_ptr->m_map.count(); } QList QChartAxisCategories::values() const { - return m_map.keys(); + return d_ptr->m_map.keys(); } QString QChartAxisCategories::label(qreal value) const { - return m_map.value(value); + return d_ptr->m_map.value(value); +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +QChartAxisCategoriesPrivate::QChartAxisCategoriesPrivate(QChartAxisCategories *q): +q_ptr(q) +{ + +} + +QChartAxisCategoriesPrivate::~QChartAxisCategoriesPrivate() +{ + } #include "moc_qchartaxiscategories.cpp" +#include "moc_qchartaxiscategories_p.cpp" QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/qchartaxiscategories.h b/src/axis/qchartaxiscategories.h index d01fbcf..974ed48 100644 --- a/src/axis/qchartaxiscategories.h +++ b/src/axis/qchartaxiscategories.h @@ -26,6 +26,8 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE +class QChartAxisCategoriesPrivate; + class QTCOMMERCIALCHART_EXPORT QChartAxisCategories : public QObject { Q_OBJECT @@ -42,14 +44,10 @@ public: void clear(); int count(); -//internal signal -Q_SIGNALS: - void updated(); - private: - QMap m_map; - -friend class QChartAxis; + QScopedPointer d_ptr; + friend class QChartAxisPrivate; + friend class Axis; }; diff --git a/src/axis/qchartaxiscategories_p.h b/src/axis/qchartaxiscategories_p.h new file mode 100644 index 0000000..6e67d8d --- /dev/null +++ b/src/axis/qchartaxiscategories_p.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// W A R N I N G +// ------------- +// +// This file is not part of the QtCommercial Chart API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. + +#ifndef QCHARTAXISCATEGORIES_P_H_ +#define QCHARTAXISCATEGORIES_P_H_ + +#include "qchartaxiscategories.h" + +QTCOMMERCIALCHART_BEGIN_NAMESPACE + +class QChartAxisCategoriesPrivate : public QObject +{ + Q_OBJECT +public: + QChartAxisCategoriesPrivate(QChartAxisCategories *q); + ~QChartAxisCategoriesPrivate(); + +Q_SIGNALS: + void updated(); + +private: + QChartAxisCategories *q_ptr; + QMap m_map; + friend class QChartAxisCategories; + +}; + +QTCOMMERCIALCHART_END_NAMESPACE + +#endif diff --git a/src/chartdataset.cpp b/src/chartdataset.cpp index b5182a5..4aad0af 100644 --- a/src/chartdataset.cpp +++ b/src/chartdataset.cpp @@ -20,16 +20,12 @@ #include "chartdataset_p.h" #include "qchartaxis.h" -//series +#include "qchartaxis_p.h" #include "qseries_p.h" -#include "qlineseries.h" -#include "qareaseries.h" #include "qbarseries.h" #include "qstackedbarseries.h" #include "qpercentbarseries.h" #include "qpieseries.h" -#include "qscatterseries.h" -#include "qsplineseries.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -68,10 +64,10 @@ void ChartDataSet::addSeries(QSeries* series, QChartAxis *axisY) if(!domain) { domain = new Domain(axisY); - QObject::connect(axisY,SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisYChanged(qreal,qreal,int,bool))); - QObject::connect(axisX(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisXChanged(qreal,qreal,int,bool))); - QObject::connect(domain,SIGNAL(rangeYChanged(qreal,qreal,int)),axisY,SLOT(handleAxisRangeChanged(qreal,qreal,int))); - QObject::connect(domain,SIGNAL(rangeXChanged(qreal,qreal,int)),axisX(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); + QObject::connect(axisY->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisYChanged(qreal,qreal,int,bool))); + QObject::connect(axisX()->d_ptr.data(),SIGNAL(changed(qreal,qreal,int,bool)),domain,SLOT(handleAxisXChanged(qreal,qreal,int,bool))); + QObject::connect(domain,SIGNAL(rangeYChanged(qreal,qreal,int)),axisY->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); + QObject::connect(domain,SIGNAL(rangeXChanged(qreal,qreal,int)),axisX()->d_ptr.data(),SLOT(handleAxisRangeChanged(qreal,qreal,int))); //initialize m_axisDomainMap.insert(axisY,domain); emit axisAdded(axisY,domain);